import unittest
import fastly
class APITest(unittest.TestCase):
def setUp(self):
self.api = fastly.API()
def test_purge(self):
self.assertTrue(self.api.purge_url('test.com', '/'))
def test_auth_error(self):
self.api.deauthenticate()
with self.assertRaises(fastly.AuthenticationError):
self.api.conn.request('GET', '/current_customer')
def test_auth_key_success(self):
self.api.authenticate_by_key('TESTAPIKEY')
def test_auth_session_success(self):
self.api.authenticate_by_password('foo@example.com', 'password')
if __name__ == '__main__':
unittest.main()