def test_logout(self): # Lets first log in and check we're good to go fluiddb.login(USERNAME, PASSWORD) result = fluiddb.call("GET", "/users/test") self.assertEqual("200", result[0]["status"]) # Log out (this should clear the Authorization header) fluiddb.logout() # We should still be able to do anonymous calls result = fluiddb.call("GET", "/users/test") self.assertEqual("200", result[0]["status"]) # but we can't do anything that requires us to be authenticated new_namespace = str(uuid.uuid4()) result = fluiddb.call("POST", "/namespaces/test", {"description": "will fail", "name": new_namespace}) self.assertEqual("401", result[0]["status"])
def setUp(self): # Only test against the SANDBOX fluiddb.instance = fluiddb.SANDBOX fluiddb.logout()