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")
Esempio n. 2
0
 def test_non_nullable_columns(self, column_name, like):
     assert_non_nullable(like, column_name)
Esempio n. 3
0
 def test_non_nullable_columns(self, column_name, user):
     assert_non_nullable(user, column_name)
Esempio n. 4
0
 def test_nullable_column(self):
     with pytest.raises(AssertionError):
         assert_non_nullable(self.user, 'name')
     with pytest.raises(AssertionError):
         assert_non_nullable(self.user, 'name')
Esempio n. 5
0
 def test_non_nullable_column(self):
     # Test everything twice so that session gets rolled back properly
     assert_non_nullable(self.user, 'age')
     assert_non_nullable(self.user, 'age')
Esempio n. 6
0
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")
Esempio n. 7
0
 def test_non_nullable_column(self):
     assert_non_nullable(self.user, 'age')
Esempio n. 8
0
 def test_non_nullable_columns(self, column_name, provision):
     assert_non_nullable(provision, column_name)
Esempio n. 9
0
 def test_non_nullable_columns(self, column_name, feedback):
     assert_non_nullable(feedback, column_name)
 def test_non_nullable_columns(self, column_name, alternative):
     assert_non_nullable(alternative, column_name)
Esempio n. 11
0
 def test_non_nullable_columns(self, column_name, hearing):
     assert_non_nullable(hearing, column_name)
Esempio n. 12
0
 def test_non_nullable_columns(self, column_name, image):
     assert_non_nullable(image, column_name)
Esempio n. 13
0
 def test_non_nullable_column(self):
     assert_non_nullable(self.user, 'age')