"""Unit tests for participant model.""" from podcast.models import participant def test_create_participants(): """Test that participants are being created successfully.""" created_partipants = participant.create_participants( 1, [ {'name': 'Fred', 'role': 'other', 'participant_id': 1}, {'name': 'Sarah', 'role': 'host', 'participant_id': 2} ], ) assert created_partipants == [ {'id': 1, 'name': 'Fred', 'podcast_id': 1, 'role': 'other', 'participant_id': 1}, {'id': 2, 'name': 'Sarah', 'podcast_id': 1, 'role': 'host', 'participant_id': 2} ] def test_create_participants_overwrites(): """Test that create participants deletes old successfully.""" participant.create_participants( 1, [ {'name': 'Fred', 'role': 'other', 'participant_id': 1}, {'name': 'Sarah', 'role': 'host', 'participant_id': 2} ], ) created_partipants = participant.create_participants( 1, [{'name': 'Joe', 'role': 'other', 'participant_id': 3}], ) assert created_partipants == [ {'id': 1, 'name': 'Joe', 'podcast_id': 1, 'role': 'other', 'participant_id': 3}, ]