Skip to content
Snippets Groups Projects
Unverified Commit c8240bd0 authored by Andreas Hubel's avatar Andreas Hubel
Browse files

fix tests

parent 61f891d5
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,9 @@ class ScheduleJSONSupport(BaseScheduleSupport):
identifier = 'schedule-json'
readonly = True
configuration_fields = None
configuration_fields = {
'feedback': ('bool', True, False, 'Enable feedback url generation'),
}
def ready(self):
r = s.head(self.remote_url)
......
......@@ -16,7 +16,10 @@ class ScheduleJSONFrabSupport(ScheduleJSONSupport):
identifier = 'schedule-json-frab'
readonly = True
configuration_fields = None
configuration_fields = {
'feedback': ('bool', True, False, 'Enable feedback url generation'),
}
base_url = None
def ready(self):
......@@ -69,7 +72,6 @@ class ScheduleJSONFrabSupport(ScheduleJSONSupport):
}
def computed_data(self, event: dict):
# TODO only add feedback_url if feedback is enabled via configuraiton_fields in ScheduleSource config
if self.conf_value('feedback'):
return {'feedback_url': f"{self.base_url}events/{event['id']}/feedback/new"}
return {}
......
......@@ -43,7 +43,7 @@
"start": "10:30",
"duration": "00:30",
"room": "Saal 1",
"slug": "37c3-12338-37c3_feierliche_eroffnung",
"slug": "37c3-12338-opening",
"title": "37C3: Feierliche Eröffnung",
"subtitle": null,
"track": "CCC",
......
......@@ -322,6 +322,16 @@ class ScheduleTests(TestCase):
@override_settings(SCHEDULES_SUPPORT_FILE_PROTOCOL=True)
def test_json_frab(self):
self.conference = Conference(
slug='37c3',
name='37th Chaos Communication Congress',
start=datetime(2023, 12, 27, 9, 0, 0, tzinfo=timezone.utc),
end=datetime(2023, 12, 31, 15, 00, 0, tzinfo=timezone.utc),
)
self.conference.save()
self.assembly = Assembly(name='CCC', slug='ccc', conference=self.conference, state_assembly=Assembly.State.PLACED)
self.assembly.save()
src = ScheduleSource.objects.create(
assembly=self.assembly,
conference=self.conference,
......@@ -344,6 +354,10 @@ class ScheduleTests(TestCase):
job.do_import()
self.assertFalse(src.has_running_import)
# print errors
if len(job.errors) > 0:
print(json.dumps(job.errors, indent=2))
# sanity checks post-import
self.assertEqual(ScheduleSourceImport.State.COMPLETED, job.state)
self.assertIsNotNone(job.data)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment