def test_create_user(self): self.assertEqual(auth.hasUser("79d4c540-91ba-11e5-a9ec-0002a5d5c51b"), False) uuid = auth.create_empty_user("79d4c540-91ba-11e5-a9ec-0002a5d5c51b", "dummy", "dummy") self.assertEqual(uuid, "79d4c540-91ba-11e5-a9ec-0002a5d5c51b") self.assertEqual(auth.hasUser("79d4c540-91ba-11e5-a9ec-0002a5d5c51b"), True)
def test_has_functions(self): self.assertEqual(auth.hasUser("00000000-0000-0000-C000-000000000046"), True) self.assertEqual(auth.hasUser("6a8f7800-91ba-11e5-af58-0002a5d5c51b"), True) self.assertEqual(auth.hasUser("576a5880-91ba-11e5-833f-0002a5d5c51b"), False) self.assertEqual(auth.hasProfile("00000000-0000-0000-C000-000000000046"), True) self.assertEqual(auth.hasProfile("6a8f7800-91ba-11e5-af58-0002a5d5c51b"), False) self.assertEqual(auth.hasProfile("576a5880-91ba-11e5-833f-0002a5d5c51b"), False)
def init_user(self, uuid, access_token): if auth.hasUser(uuid) and auth.hasProfile(uuid): return False else: if auth.create_empty_user(uuid, self.provider_name, access_token): return True else: raise RuntimeError
def init_session_with_uuid(self, uuid, request): if auth.hasUser(uuid): if auth.create_session(request, uuid): if auth.hasProfile(uuid): return redirect("digikey.views.progress_page") else: return redirect("login.views.profile") else: raise RuntimeError else: raise RuntimeError