def test_shop_db_model_constraints(db_session: Session): owner = OwnerFactory() owner.create(db_session) shop = Shop( name="My Shop Name", address="My shop address", owner_id=owner.id, location="POINT(45 32)", radius_metres=500, ) db_session.add(shop) db_session.commit() assert_non_nullable(shop, "id") assert_max_length(shop, "id", 100) assert_non_nullable(shop, "name") assert_max_length(shop, "name", 50) assert_non_nullable(shop, "address") assert_max_length(shop, "address", 50) assert_non_nullable(shop, "owner_id") assert_non_nullable(shop, "location") assert_non_nullable(shop, "radius_metres") assert_non_nullable(shop, "is_available") assert_nullable(shop, "phone_number")
def test_profile_constraints(profile): assert_nullable(profile, "name") assert_max_length(profile, "name", 255) assert_non_nullable(profile, "email") assert_max_length(profile, "email", 255) assert_non_nullable(profile, "password") assert_nullable(profile, "birth_date") assert_nullable(profile, "best_friend_id") assert_non_nullable(profile, "_friend_count")
def test_non_nullable_column(self): with pytest.raises(AssertionError): assert_nullable(self.user, 'age') with pytest.raises(AssertionError): assert_nullable(self.user, 'age')
def test_nullable_column(self): assert_nullable(self.user, 'name') assert_nullable(self.user, 'name')
def test_nullable_column(self, user): assert_nullable(user, 'name') assert_nullable(user, 'name')
def test_updated_at_is_nullable(self, feedback): assert_nullable(feedback, 'updated_at')
def test_updated_at_is_nullable(self, alternative): assert_nullable(alternative, 'updated_at')
def test_hearing_id_is_nullable(self, alternative): assert_nullable(alternative, 'hearing_id')
def test_closes_at_is_nullable(self, hearing): assert_nullable(hearing, 'closes_at')
def test_opens_at_is_nullable(self, hearing): assert_nullable(hearing, 'opens_at')
def test_updated_at_is_nullable(self, hearing): assert_nullable(hearing, 'updated_at')
def test_updated_at_is_nullable(self, image): assert_nullable(image, 'updated_at')