def test_login_logout(self): instance_ref = self.client.query( query.create(self.collection_ref, {"credentials": {"password": "******"}}))["ref"] secret = self.client.query( query.login(instance_ref, {"password": "******"}))["secret"] instance_client = self.client.new_session_client(secret=secret) self.assertEqual(instance_client.query( query.select("ref", query.get(Ref("self", Ref("widgets", Native.COLLECTIONS))))), instance_ref) self.assertTrue(instance_client.query(query.logout(True)))
def logout(user, logout_type): if logout_type == "all": all_tokens = True else: all_tokens = False user_client = FaunaClient(secret=session["user_secret"]) result = user_client.query(q.logout(all_tokens)) session.clear() return redirect(url_for("index"))
def test_logout(self): self.assertJson(query.logout(True), '{"logout":true}')
def logout(): try: return current_app.fauna_client.query(q.logout(True)) except Exception as e: print(e)