def test_no_query_id(self): auth = ApiKeyAuthentication() with app.test_client() as c: rv = c.get("/api/queries", query_string={"api_key": self.api_key}) self.assertFalse(auth.verify_authentication())
def test_wrong_api_key(self): auth = ApiKeyAuthentication() with app.test_client() as c: rv = c.get("/api/queries/{0}".format(self.query.id), query_string={"api_key": "whatever"}) self.assertFalse(auth.verify_authentication())
def test_correct_api_key(self): auth = ApiKeyAuthentication() with app.test_client() as c: rv = c.get("/api/queries/{0}".format(self.query.id), query_string={"api_key": self.api_key}) self.assertTrue(auth.verify_authentication())
def test_no_api_key(self): auth = ApiKeyAuthentication() with app.test_client() as c: rv = c.get("/api/queries/{0}".format(self.query.id)) self.assertFalse(auth.verify_authentication())
def test_no_query_id(self): auth = ApiKeyAuthentication() with app.test_client() as c: rv = c.get('/api/queries', query_string={'api_key': self.api_key}) self.assertFalse(auth.verify_authentication())
def test_correct_api_key(self): auth = ApiKeyAuthentication() with app.test_client() as c: rv = c.get('/api/queries/{0}'.format(self.query.id), query_string={'api_key': self.api_key}) self.assertTrue(auth.verify_authentication())
def test_wrong_api_key(self): auth = ApiKeyAuthentication() with app.test_client() as c: rv = c.get('/api/queries/{0}'.format(self.query.id), query_string={'api_key': 'whatever'}) self.assertFalse(auth.verify_authentication())
def test_no_api_key(self): auth = ApiKeyAuthentication() with app.test_client() as c: rv = c.get('/api/queries/{0}'.format(self.query.id)) self.assertFalse(auth.verify_authentication())