Ejemplo n.º 1
0
 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())
Ejemplo n.º 2
0
 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())
Ejemplo n.º 3
0
 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())
Ejemplo n.º 4
0
 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())
Ejemplo n.º 5
0
 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())
Ejemplo n.º 6
0
 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())
Ejemplo n.º 7
0
 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())
Ejemplo n.º 8
0
 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())