コード例 #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())
コード例 #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())
コード例 #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())
コード例 #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())
コード例 #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())
コード例 #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())
コード例 #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())
コード例 #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())