def test_54_list_all_comments_added_to_hearing_check_created_at( api_client, default_hearing): response = api_client.get( get_hearing_detail_url(default_hearing.id, 'comments')) data = get_data_from_response(response) for comment in data: assert_datetime_fuzzy_equal(now(), comment['created_at'])
def test_8_get_detail_closing_time(api_client): hearing = Hearing(title='title') hearing.save() response = api_client.get(get_detail_url(hearing.id)) data = get_data_from_response(response) assert 'results' not in data assert_datetime_fuzzy_equal(data['close_at'], hearing.close_at)
def test_8_get_detail_closing_time(api_client): hearing = Hearing() hearing.save() response = api_client.get(get_detail_url(hearing.id)) data = get_data_from_response(response) assert 'results' not in data assert_datetime_fuzzy_equal(data['close_at'], hearing.close_at)
def test_json_importer(): data = deepcopy(EXAMPLE_DATA) hearing_id = get_random_string() hearing_data = data["hearings"]["1"] hearing_data["slug"] = hearing_id import_from_data(data) hearing = Hearing.objects.get(id=hearing_id) assert_datetime_fuzzy_equal(hearing.modified_at, parse_aware_datetime(hearing_data["updated_at"])) assert_datetime_fuzzy_equal(hearing.created_at, parse_aware_datetime(hearing_data["created_at"])) assert hearing.title == 'ikwnydbg hjl riffyjsbrq shxv nkl' assert hearing.sections.filter(type__identifier=InitialSectionType.SCENARIO).count() == 2 assert hearing.sections.filter(type__identifier=InitialSectionType.PART).count() == 1
def test_json_importer(): data = deepcopy(EXAMPLE_DATA) hearing_id = get_random_string() hearing_data = data["hearings"]["1"] hearing_data["slug"] = hearing_id import_from_data(data) hearing = Hearing.objects.get(id=hearing_id) assert_datetime_fuzzy_equal(hearing.modified_at, parse_aware_datetime(hearing_data["updated_at"])) assert_datetime_fuzzy_equal(hearing.created_at, parse_aware_datetime(hearing_data["created_at"])) assert hearing.title == 'ikwnydbg hjl riffyjsbrq shxv nkl' assert hearing.sections.filter(type__identifier=InitialSectionType.SCENARIO).count() == 2 assert hearing.sections.filter(type__identifier=InitialSectionType.PART).count() == 1 assert hearing.comments.count() == 2
def assert_hearing_equals(data, posted, user, create=True): posted['contact_persons'][0].update({'organization': 'The department for squirrel welfare'}) posted.pop('id') created_at = data.pop('created_at') if create: assert_datetime_fuzzy_equal(created_at, now()) organization = data.pop('organization') assert organization == user.get_default_organization().name assert len(data['sections']) == len(posted['sections']) sections_created = data.pop('sections') sections_posted = posted.pop('sections') assert_common_keys_equal(data, posted) for section_created, section_posted in zip(sections_created, sections_posted): section_created.pop('id', None) created_at = section_created.pop('created_at') if create: assert_datetime_fuzzy_equal(created_at, now()) images = section_created.pop('images') assert len(images) == len(section_posted['images']) assert_common_keys_equal(section_created, section_posted)
def test_54_list_all_comments_added_to_hearing_check_created_at(api_client, default_hearing): response = api_client.get(get_hearing_detail_url(default_hearing.id, 'comments')) data = get_data_from_response(response) for comment in data: assert_datetime_fuzzy_equal(now(), comment['created_at'])