def test_create(self): client_id = '87y8d7qyw8d7yq8w7ydwqwd' t = Template() t.stub_request("templates/%s.json" % client_id, "create_template.json") template_id = t.create(client_id, "Template One", "http://templates.org/index.html", "http://templates.org/files.zip") self.assertEquals(template_id, "98y2e98y289dh89h9383891234") self.assertEquals(t.template_id, "98y2e98y289dh89h9383891234")
def test_unauthorized_on_put(self): template = Template(self.cs.auth_details, "uhiuhiuhiuhiuhiuhiuh") template.stub_request('templates/uhiuhiuhiuhiuhiuhiuh.json', 'custom_api_error.json', status=401) self.assertRaises(self.error_responses[401], template.update, "Template One Updated", "http://templates.org/index.html", "http://templates.org/files.zip")
def test_server_error_on_put(self): template = Template(self.cs.auth_details, "uhiuhiuhiuhiuhiuhiuh") template.stub_request('templates/uhiuhiuhiuhiuhiuhiuh.json', None, status=500) self.assertRaises(self.error_responses[500], template.update, "Template One Updated", "http://templates.org/index.html", "http://templates.org/files.zip")
def test_server_error_on_delete(self): template = Template(self.cs.auth_details, "uhiuhiuhiuhiuhiuhiuh") template.stub_request('templates/uhiuhiuhiuhiuhiuhiuh.json', None, status=500) self.assertRaises(self.error_responses[500], template.delete)
def test_other_client_error_on_delete(self): template = Template(self.cs.auth_details, "uhiuhiuhiuhiuhiuhiuh") template.stub_request('templates/uhiuhiuhiuhiuhiuhiuh.json', None, status=418) self.assertRaises(self.error_responses[418], template.delete)
def test_not_found_on_delete(self): template = Template(self.cs.auth_details, "uhiuhiuhiuhiuhiuhiuh") template.stub_request('templates/uhiuhiuhiuhiuhiuhiuh.json', None, status=404) self.assertRaises(self.error_responses[404], template.delete)
def test_unauthorized_on_delete(self): template = Template(self.cs.auth_details, "uhiuhiuhiuhiuhiuhiuh") template.stub_request('templates/uhiuhiuhiuhiuhiuhiuh.json', 'custom_api_error.json', status=401) self.assertRaises(self.error_responses[401], template.delete)
def setUp(self): self.template = Template({'api_key': '123123123123123123123'}, "98y2e98y289dh89h938389")
def test_server_error_on_delete(self): template = Template(self.cs.auth_details, "uhiuhiuhiuhiuhiuhiuh") template.stub_request( 'templates/uhiuhiuhiuhiuhiuhiuh.json', None, status=500) self.assertRaises(self.error_responses[500], template.delete)
def setUp(self): self.template = Template( { "access_token": "ASP95S4aR+9KsgfHB0dapTYxNA==", "refresh_token": "5S4aASP9R+9KsgfHB0dapTYxNA==" }, "98y2e98y289dh89h938389")
def test_other_client_error_on_delete(self): template = Template(self.cs.auth_details, "uhiuhiuhiuhiuhiuhiuh") template.stub_request( 'templates/uhiuhiuhiuhiuhiuhiuh.json', None, status=418) self.assertRaises(self.error_responses[418], template.delete)
def test_not_found_on_delete(self): template = Template(self.cs.auth_details, "uhiuhiuhiuhiuhiuhiuh") template.stub_request( 'templates/uhiuhiuhiuhiuhiuhiuh.json', None, status=404) self.assertRaises(self.error_responses[404], template.delete)
def test_unauthorized_on_delete(self): template = Template(self.cs.auth_details, "uhiuhiuhiuhiuhiuhiuh") template.stub_request( 'templates/uhiuhiuhiuhiuhiuhiuh.json', 'custom_api_error.json', status=401) self.assertRaises(self.error_responses[401], template.delete)
def test_server_error_on_put(self): template = Template(self.cs.auth_details, "uhiuhiuhiuhiuhiuhiuh") template.stub_request( 'templates/uhiuhiuhiuhiuhiuhiuh.json', None, status=500) self.assertRaises(self.error_responses[500], template.update, "Template One Updated", "http://templates.org/index.html", "http://templates.org/files.zip")
def test_unauthorized_on_put(self): template = Template(self.cs.auth_details, "uhiuhiuhiuhiuhiuhiuh") template.stub_request( 'templates/uhiuhiuhiuhiuhiuhiuh.json', 'custom_api_error.json', status=401) self.assertRaises(self.error_responses[401], template.update, "Template One Updated", "http://templates.org/index.html", "http://templates.org/files.zip")