Skip to content

Commit

Permalink
#26 - adding test for enable and disable mutations
Browse files Browse the repository at this point in the history
  • Loading branch information
Sascha Dobbelaere committed Nov 27, 2023
1 parent 0a7916a commit 71836fb
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion OneSila/core/tests/tests_schemas/tests_mutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,40 @@ def test_invite_user(self):
self.assertTrue(resp.data['inviteUser']['invitationAccepted'])

def test_enable_disable_user(self):
pass
password = '22kk22@ksk!aAD'
company = MultiTenantCompany.objects.create(name='enableuser', country="DE")
user = MultiTenantUser(username='enabledisable@maadil.com', language="nl", multi_tenant_company=company,
is_active=False)
user.set_password(password)
user.save()

user_id = to_base64("MultiTenantUserType", user.id)

enable_query = """
mutation enableUser($id: GlobalID!){
enableUser(data: {id: $id}){
username
isActive
}
}
"""

resp = self.stawberry_test_client(
query=enable_query,
variables={"id": user_id}
)

self.assertTrue(resp.errors is None)
self.assertTrue(resp.data['inviteUser']['isActive'])

disable_query = """
mutation disableUser($id: GlobalID!){
disableUser(data: {id: $id}){
username
isActive
}
}
"""

self.assertTrue(resp.errors is None)
self.assertFalse(resp.data['inviteUser']['isActive'])

0 comments on commit 71836fb

Please sign in to comment.