コード例 #1
0
 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")
コード例 #2
0
 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")
コード例 #3
0
 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")
コード例 #4
0
 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")
コード例 #5
0
 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)
コード例 #6
0
 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)
コード例 #7
0
 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)
コード例 #8
0
 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)
コード例 #9
0
 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)
コード例 #10
0
 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)
コード例 #11
0
 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)
コード例 #12
0
 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)
コード例 #13
0
 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")
コード例 #14
0
 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")