"""Tests for track_contributor MySQL queries.""" from datetime import datetime from contributor.queries.mysql.track_contributor import TrackContributor class TestTrackContributorModel: def test_model_has_correct_tablename(self) -> None: assert TrackContributor.__tablename__ == "track_contributors" def test_model_instantiation_with_all_fields(self) -> None: created_at = datetime.now() updated_at = datetime.now() track_contributor = TrackContributor( id=1, track_id=100, contributor_id=50, contributor_role_id=10, sequence_number=1, created_at=created_at, updated_at=updated_at, ) assert track_contributor.id == 1 assert track_contributor.track_id == 100 assert track_contributor.contributor_id == 50 assert track_contributor.contributor_role_id == 10 assert track_contributor.sequence_number == 1 assert track_contributor.created_at == created_at assert track_contributor.updated_at == updated_at def test_model_instantiation_with_required_fields_only(self) -> None: track_contributor = TrackContributor( track_id=100, contributor_id=50, contributor_role_id=10, created_at=datetime.now(), updated_at=datetime.now(), ) assert track_contributor.track_id == 100 assert track_contributor.contributor_id == 50 assert track_contributor.contributor_role_id == 10 def test_model_instantiation_with_sequence_number(self) -> None: track_contributor = TrackContributor( track_id=100, contributor_id=50, contributor_role_id=10, sequence_number=5, created_at=datetime.now(), updated_at=datetime.now(), ) assert track_contributor.sequence_number == 5 def test_model_has_all_required_attributes(self) -> None: required_fields = [ "id", "track_id", "contributor_id", "contributor_role_id", "sequence_number", "created_at", "updated_at", ] for field in required_fields: assert hasattr(TrackContributor, field)