mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:26:08 -05:00
Add endpoint to allow org team members to be removed
This is similar to the corresponding endpoint for services. However, it is a little simpler since we don't need to worry about always having at least one team member for an organisation. The new dao function added, `dao_remove_user_from_organisation`, is also simpler than `dao_remove_user_from_service` since we don't have any organisation permissions to deal with.
This commit is contained in:
@@ -694,6 +694,32 @@ def test_add_user_to_organisation_returns_404_if_user_does_not_exist(admin_reque
|
||||
)
|
||||
|
||||
|
||||
def test_remove_user_from_organisation(admin_request, sample_organisation, sample_user):
|
||||
dao_add_user_to_organisation(organisation_id=sample_organisation.id, user_id=sample_user.id)
|
||||
|
||||
admin_request.delete(
|
||||
'organisation.remove_user_from_organisation',
|
||||
organisation_id=sample_organisation.id,
|
||||
user_id=sample_user.id
|
||||
)
|
||||
|
||||
assert sample_organisation.users == []
|
||||
|
||||
|
||||
def test_remove_user_from_organisation_when_user_is_not_an_org_member(admin_request, sample_organisation, sample_user):
|
||||
resp = admin_request.delete(
|
||||
'organisation.remove_user_from_organisation',
|
||||
organisation_id=sample_organisation.id,
|
||||
user_id=sample_user.id,
|
||||
_expected_status=404
|
||||
)
|
||||
|
||||
assert resp == {
|
||||
'result': 'error',
|
||||
'message': 'User not found'
|
||||
}
|
||||
|
||||
|
||||
def test_get_organisation_users_returns_users_for_organisation(admin_request, sample_organisation):
|
||||
first = create_user(email='first@invited.com')
|
||||
second = create_user(email='another@invited.com')
|
||||
|
||||
Reference in New Issue
Block a user