Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
| Download
Views: 18655
1
from unittest import TestCase
2
import frontmatter
3
from pbx_gs_python_utils.utils.Dev import Dev
4
from pbx_gs_python_utils.utils.Files import Files
5
6
from oss_hugo.API_Hugo_OSS import API_Hugo_OSS
7
from oss_hugo.OSS_Participant import OSS_Participant
8
9
10
class test_API_Hugo_OSS(TestCase):
11
12
def setUp(self):
13
self.api = API_Hugo_OSS()
14
self.result = None
15
16
def tearDown(self):
17
if self.result is not None:
18
Dev.pprint(self.result)
19
20
def test_df_field(self):
21
df = self.api.df_field('chapter_leader').set_index('title')
22
data = df.to_dict()['chapter_leader']
23
assert data['Sebastien Deleersnyder'] == 'Belgium'
24
25
def test_md_files_in_folder(self):
26
assert len(self.api.md_files_in_folder('content/participant')) > 50
27
28
def test_md_files_participants(self):
29
assert len(self.api.md_files_participants()) >50
30
31
32
def test_participants(self):
33
participants = self.api.participants()
34
assert len(participants) > 50
35
assert set(participants.values().__iter__().__next__()) == {'content', 'path', 'metadata'}
36
37
38
def test_participants__return_oss_participants(self):
39
participants = self.api.participants(return_oss_participants=True)
40
assert len(participants) > 50
41
assert type(list(participants.values())[0]) == OSS_Participant
42
assert 'Dinis Cruz' in set(participants)
43
44
45
46
def test_participants_metadatas(self):
47
assert len(self.api.participants_metadatas()) > 50
48
49
50