You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
resource_type = 'program', is_professional = True, no_price = True
@pytest.mark.django_db()
@pytest.mark.parametrize(
"resource_type",
set(LearningResourceType.names()) - {LearningResourceType.course.name},
)
@pytest.mark.parametrize("is_professional", [True, False])
@pytest.mark.parametrize("no_price", [True, False])
def test_serialize_learning_resource_for_bulk(resource_type, is_professional, no_price):
"""
Test that serialize_program_for_bulk yields a valid LearningResourceSerializer for resource types other than "course"
The "course" resource type is tested by `test_serialize_course_numbers_for_bulk` below.
"""
resource = factories.LearningResourceFactory.create(
resource_type=resource_type, professional=is_professional, runs=[]
)
LearningResourceRunFactory.create(
learning_resource=resource, prices=[Decimal(0.00 if no_price else 1.00)]
)
free_dict = {
"free": resource_type
not in [LearningResourceType.program.name, LearningResourceType.course.name]
or (no_price and not is_professional)
}
> assert serializers.serialize_learning_resource_for_bulk(resource) == {
"_id": resource.id,
"resource_relations": {"name": "resource"},
"created_on": resource.created_on,
**free_dict,
**LearningResourceSerializer(resource).data,
}
E AssertionError: assert {'_id': 2868,...g 8852'], ...} == {'_id': 2868,...g 8852'], ...}
E Omitting 30 identical items, use -vv to show
E Differing items:
E {'program': {'courses': [{'id': 2869, 'topics': [{'id': 8280, 'name': 'Topic 8281', 'parent': None, 'channel_url': Non...d': True, 'languages': ['es'], 'url': 'https://lopez-martinez.org/', 'professional': False, 'next_start_date': None}]}} != {'program': {'courses': [{'id': 2869, 'topics': [{'id': 8280, 'name': 'Topic 8281', 'parent': None, 'channel_url': Non...d': True, 'languages': ['es'], 'url': 'https://lopez-martinez.org/', 'professional': False, 'next_start_date': None}]}}
E Full diff:
E {
E '_id': 2868,
E 'certification': True,
E 'certification_type': {'code': 'professional',
E 'name': 'Professional Certificate'},
E 'course_feature': ['Tag 8849', 'Tag 8850', 'Tag 8851', 'Tag 8852'],
E 'created_on': datetime.datetime(2024, 6, 12, 18, 7, 13, 553775, tzinfo=datetime.timezone.utc),
E 'departments': [{'channel_url': None,
E 'department_id': '2818',
E 'name': '2818 name',
E 'school': {'id': 2816,
E 'name': '2815 name',
E 'url': 'https://green.info/'}}],
E 'description': 'Could medical expect indicate kitchen.',
E 'free': False,
E 'full_description': 'Guess security her hard hear sing city cost. Left '
E 'shoulder subject government. Billion everything movie no '
E 'common race.',
E 'id': 2868,
E 'image': {'id': 6327, 'url': 'https://www.duarte-campbell.com/', 'description': 'Family throughout consumer deal scientist stage watch. Expert whose ready sound second prevent course.\nFilm face red. Our stay imagine play remain much shake.', 'alt': 'Standard majority responsibility rock responsibility low ground total. Reality away another role identify. Evening power professional today receive way.'},
E 'languages': ['es'],
E 'last_modified': '[199](https://github.com/mitodl/mit-open/actions/runs/9487430224/job/26144060434?pr=1063#step:11:200)7-11-22T15:34:39.043868Z',
E 'learning_format': [{'code': 'in_person', 'name': 'In person'}],
E 'learning_path_parents': [],
E 'next_start_date': None,
E 'offered_by': {'channel_url': None,
E 'code': 'see',
E 'name': 'Sloan Executive Education'},
E 'platform': {'code': 'globalalumni', 'name': 'Global Alumni'},
E 'prices': [Decimal('0.00')],
E 'professional': True,
The text was updated successfully, but these errors were encountered:
Expected Behavior
Test should always pass
Current Behavior
Test fails intermittentlyl. failure log https://github.com/mitodl/mit-open/actions/runs/9487430224/job/26144060434?pr=1063#step:11:163
The text was updated successfully, but these errors were encountered: