Skip to content

Commit

Permalink
refactor(tests): move asserts out of fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
thekaveman committed Jul 14, 2023
1 parent a7a420d commit dd14e49
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
13 changes: 0 additions & 13 deletions tests/pytest/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ def model_AuthProvider():
authority="https://example.com",
)

assert not auth_provider.supports_claims_verification
assert auth_provider.supports_sign_out

return auth_provider


Expand All @@ -63,8 +60,6 @@ def model_AuthProvider_with_verification(model_AuthProvider):
model_AuthProvider.claim = "claim"
model_AuthProvider.save()

assert model_AuthProvider.supports_claims_verification

return model_AuthProvider


Expand All @@ -76,9 +71,6 @@ def model_AuthProvider_with_verification_no_sign_out(model_AuthProvider):
model_AuthProvider.sign_out_link_template = None
model_AuthProvider.save()

assert model_AuthProvider.supports_claims_verification
assert not model_AuthProvider.supports_sign_out

return model_AuthProvider


Expand All @@ -88,8 +80,6 @@ def model_AuthProvider_without_verification(model_AuthProvider):
model_AuthProvider.claim = None
model_AuthProvider.save()

assert not model_AuthProvider.supports_claims_verification

return model_AuthProvider


Expand All @@ -101,9 +91,6 @@ def model_AuthProvider_without_verification_no_sign_out(model_AuthProvider):
model_AuthProvider.sign_out_link_template = None
model_AuthProvider.save()

assert not model_AuthProvider.supports_claims_verification
assert not model_AuthProvider.supports_sign_out

return model_AuthProvider


Expand Down
30 changes: 29 additions & 1 deletion tests/pytest/core/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,35 @@ def test_PemData_data_remote(model_PemData, mocker):


@pytest.mark.django_db
def test_EligibilityType_str(model_EligibilityType):
def test_model_AuthProvider(model_AuthProvider):
assert not model_AuthProvider.supports_claims_verification
assert model_AuthProvider.supports_sign_out


@pytest.mark.django_db
def test_model_AuthProvider_with_verification(model_AuthProvider_with_verification):
assert model_AuthProvider_with_verification.supports_claims_verification


@pytest.mark.django_db
def test_model_AuthProvider_with_verification_no_sign_out(model_AuthProvider_with_verification_no_sign_out):
assert model_AuthProvider_with_verification_no_sign_out.supports_claims_verification
assert not model_AuthProvider_with_verification_no_sign_out.supports_sign_out


@pytest.mark.django_db
def test_model_AuthProvider_without_verification(model_AuthProvider_without_verification):
assert not model_AuthProvider_without_verification.supports_claims_verification


@pytest.mark.django_db
def model_AuthProvider_without_verification_no_sign_out(model_AuthProvider_without_verification_no_sign_out):
assert not model_AuthProvider_without_verification_no_sign_out.supports_claims_verification
assert not model_AuthProvider_without_verification_no_sign_out.supports_sign_out


@pytest.mark.django_db
def test_test_EligibilityType_str(model_EligibilityType):
assert str(model_EligibilityType) == model_EligibilityType.label


Expand Down

0 comments on commit dd14e49

Please sign in to comment.