Check for member in application function, not user function
This commit is contained in:
@@ -4,6 +4,7 @@ from tests.factories import (
|
||||
ApplicationFactory,
|
||||
ApplicationRoleFactory,
|
||||
EnvironmentFactory,
|
||||
UserFactory,
|
||||
)
|
||||
|
||||
|
||||
@@ -38,3 +39,16 @@ def test_audit_event_for_application_deletion(session):
|
||||
)
|
||||
assert update_event.changed_state.get("deleted")
|
||||
assert update_event.changed_state["deleted"] == [False, True]
|
||||
|
||||
|
||||
def test_has_app_member():
|
||||
user = UserFactory.create()
|
||||
app = ApplicationFactory.create()
|
||||
ApplicationRoleFactory.create(user=user, application=app)
|
||||
assert app.has_member(user)
|
||||
|
||||
|
||||
def test_does_not_have_app_member():
|
||||
user = UserFactory.create()
|
||||
app = ApplicationFactory.create()
|
||||
assert not app.has_member(user)
|
||||
|
@@ -26,19 +26,6 @@ def test_cannot_update_dod_id(session):
|
||||
session.commit()
|
||||
|
||||
|
||||
def test_is_app_member():
|
||||
user = UserFactory.create()
|
||||
app = ApplicationFactory.create()
|
||||
ApplicationRoleFactory.create(user=user, application=app)
|
||||
assert user.is_app_member(app)
|
||||
|
||||
|
||||
def test_is_not_app_member():
|
||||
user = UserFactory.create()
|
||||
app = ApplicationFactory.create()
|
||||
assert not user.is_app_member(app)
|
||||
|
||||
|
||||
def test_deleted_application_roles_are_ignored(session):
|
||||
user = UserFactory.create()
|
||||
app = ApplicationFactory.create()
|
||||
|
Reference in New Issue
Block a user