54 |
54 |
"id": "events-B",
|
55 |
55 |
"kind": "events",
|
56 |
56 |
"text": "Events B",
|
|
57 |
"category": "category-b",
|
57 |
58 |
},
|
58 |
59 |
]
|
59 |
60 |
|
... | ... | |
64 |
65 |
"id": "meetings-A",
|
65 |
66 |
"kind": "meetings",
|
66 |
67 |
"text": "Meetings A",
|
|
68 |
"category": "category-a",
|
67 |
69 |
},
|
68 |
70 |
{
|
69 |
71 |
"api": {
|
... | ... | |
72 |
74 |
"id": "virtual-B",
|
73 |
75 |
"kind": "virtual",
|
74 |
76 |
"text": "Virtual B",
|
|
77 |
"category": "category-b",
|
75 |
78 |
},
|
76 |
79 |
]
|
77 |
80 |
|
... | ... | |
111 |
114 |
NamedDataSource.wipe()
|
112 |
115 |
|
113 |
116 |
urlopen.side_effect = lambda *args: io.StringIO('{"data": []}')
|
114 |
|
assert collect_agenda_data(pub) == []
|
|
117 |
assert collect_agenda_data(pub) == [
|
|
118 |
{
|
|
119 |
'slug': 'agenda-all',
|
|
120 |
'text': 'All agendas',
|
|
121 |
'url': 'http://chrono.example.net/api/agenda/',
|
|
122 |
},
|
|
123 |
]
|
115 |
124 |
assert urlopen.call_args_list == [mock.call('http://chrono.example.net/api/agenda/')]
|
116 |
125 |
|
117 |
126 |
urlopen.side_effect = ConnectionError
|
... | ... | |
123 |
132 |
urlopen.side_effect = lambda *args: io.StringIO(json.dumps({"data": AGENDA_EVENTS_DATA}))
|
124 |
133 |
urlopen.reset_mock()
|
125 |
134 |
assert collect_agenda_data(pub) == [
|
|
135 |
{
|
|
136 |
'slug': 'agenda-all',
|
|
137 |
'text': 'All agendas',
|
|
138 |
'url': 'http://chrono.example.net/api/agenda/',
|
|
139 |
},
|
|
140 |
{
|
|
141 |
'slug': 'agenda-category-category-b',
|
|
142 |
'text': 'All agendas of category category-b',
|
|
143 |
'url': 'http://chrono.example.net/api/agenda/?category=category-b',
|
|
144 |
},
|
126 |
145 |
{
|
127 |
146 |
'slug': 'agenda-events-events-A',
|
128 |
147 |
'text': 'Events A',
|
... | ... | |
144 |
163 |
]
|
145 |
164 |
urlopen.reset_mock()
|
146 |
165 |
assert collect_agenda_data(pub) == [
|
|
166 |
{
|
|
167 |
'slug': 'agenda-all',
|
|
168 |
'text': 'All agendas',
|
|
169 |
'url': 'http://chrono.example.net/api/agenda/',
|
|
170 |
},
|
|
171 |
{
|
|
172 |
'slug': 'agenda-category-category-a',
|
|
173 |
'text': 'All agendas of category category-a',
|
|
174 |
'url': 'http://chrono.example.net/api/agenda/?category=category-a',
|
|
175 |
},
|
|
176 |
{
|
|
177 |
'slug': 'agenda-category-category-b',
|
|
178 |
'text': 'All agendas of category category-b',
|
|
179 |
'url': 'http://chrono.example.net/api/agenda/?category=category-b',
|
|
180 |
},
|
147 |
181 |
{
|
148 |
182 |
'slug': 'agenda-meetings-meetings-A-meetingtypes',
|
149 |
183 |
'text': 'Meetings A - Meeting types',
|