require key authentication for purge_by_key

This commit is contained in:
Thom Mahoney 2014-09-15 10:49:11 -07:00
parent b0dd18d4e4
commit 1bc048d1c7
3 changed files with 17 additions and 0 deletions

View file

@ -11,6 +11,17 @@ class APITest(unittest.TestCase):
def test_purge(self):
self.assertTrue(self.api.purge_url('test.com', '/'))
def test_purge_by_key(self):
self.api.deauthenticate()
self.api.authenticate_by_key('TESTAPIKEY')
self.assertTrue(self.api.purge_key('test.com', 'foo'))
def test_cookie_purge_by_key(self):
self.api.deauthenticate()
self.api.authenticate_by_password('foo@example.com', 'password')
with self.assertRaises(fastly.AuthenticationError):
self.api.purge_key('test.com', 'foo')
def test_auth_error(self):
self.api.deauthenticate()
with self.assertRaises(fastly.AuthenticationError):