test: update invite partner and register tests

pull/117/head
Kevin ICOL 4 years ago
parent 8b28aacc13
commit dca45d1909
  1. 3
      tests/handlers/test_watcha_invite_partner.py
  2. 5
      tests/rest/client/v1/test_watcha_register.py

@ -78,6 +78,7 @@ class InvitePartnerHandlerTestCase(unittest.HomeserverTestCase):
self.keycloak_client = self.nextcloud_handler.keycloak_client
self.nextcloud_client = self.nextcloud_handler.nextcloud_client
self.keycloak_client.add_user = simple_async_mock()
self.keycloak_client.update_user = simple_async_mock()
self.keycloak_client.get_user = simple_async_mock(return_value={"id": "partner"})
self.nextcloud_client.add_user = simple_async_mock()
@ -93,6 +94,7 @@ class InvitePartnerHandlerTestCase(unittest.HomeserverTestCase):
self.render(request)
self.assertTrue(self.keycloak_client.add_user.called)
self.assertTrue(self.keycloak_client.update_user.called)
self.assertTrue(self.keycloak_client.get_user.called)
self.assertTrue(self.nextcloud_client.add_user.called)
@ -111,6 +113,7 @@ class InvitePartnerHandlerTestCase(unittest.HomeserverTestCase):
self.render(request)
self.keycloak_client.add_user.not_called()
self.keycloak_client.update_user.not_called()
self.keycloak_client.get_user.not_called()
self.nextcloud_client.add_user.not_called()

@ -71,6 +71,7 @@ class RegisterTestCase(unittest.HomeserverTestCase):
self.keycloak_client = hs.get_keycloak_client()
self.nextcloud_client = hs.get_nextcloud_client()
self.keycloak_client.add_user = simple_async_mock()
self.keycloak_client.update_user = simple_async_mock()
self.keycloak_client.get_user = simple_async_mock(return_value={"id": "user1"})
self.nextcloud_client.add_user = simple_async_mock()
@ -88,6 +89,7 @@ class RegisterTestCase(unittest.HomeserverTestCase):
self.render(request)
self.assertTrue(self.keycloak_client.add_user.called)
self.assertTrue(self.keycloak_client.update_user.called)
self.assertTrue(self.keycloak_client.get_user.called)
self.assertTrue(self.nextcloud_client.add_user.called)
self.assertEqual(channel.code, 200)
@ -106,6 +108,7 @@ class RegisterTestCase(unittest.HomeserverTestCase):
self.render(request)
self.assertTrue(self.keycloak_client.add_user.called)
self.assertTrue(self.keycloak_client.update_user.called)
self.assertTrue(self.keycloak_client.get_user.called)
self.assertTrue(self.nextcloud_client.add_user.called)
self.assertEqual(channel.code, 200)
@ -124,6 +127,7 @@ class RegisterTestCase(unittest.HomeserverTestCase):
self.render(request)
self.keycloak_client.add_user.not_called()
self.keycloak_client.update_user.not_called()
self.keycloak_client.get_user.not_called()
self.nextcloud_client.add_user.not_called()
@ -147,6 +151,7 @@ class RegisterTestCase(unittest.HomeserverTestCase):
self.render(request)
self.keycloak_client.add_user.not_called()
self.keycloak_client.update_user.not_called()
self.keycloak_client.get_user.not_called()
self.nextcloud_client.add_user.not_called()

Loading…
Cancel
Save