def test_newinstance(self): json = { "project": "testproject", "tools": [{ "tool_name": "newtool", "instances": [{ "instance_name": "test", "api_name": "DEMO_APP", "api_key": "DEMO_KEY", "properties": [{ "property_name": "exceptions", "active": False, "thresholds": [{ "min": 0, "color": "green" }, { "min": 5, "color": "orange" }, { "min": 20, "color": "red" }] }] }] }] } result = create_post(self.api, json) self.assertEqual(result, 200)
def test_InvalidJSON(self): result = create_post(api, self.httpRequestInvalidJson) self.assertEqual(400, result)
def test_ProjectNotFound(self): result = create_post(api, self.httpRequestNotFoundData) self.assertEqual(404, result)
def test_ProjectInvalidString(self): result = create_post(api, self.httpRequestFalseData) self.assertEqual(400, result)
def test_validProject(self): # need valid project result = create_post(api, self.httpRequestData) self.assertEqual(200, result)
def test_theNoBodyBody(self): result = create_post(self.api, "") self.assertEqual(result, 400)
def test_CorrectData(self): result = create_post(self.api, self.correctData) self.assertEqual(result, 200)
def test_invalidJson(self): result = create_post(self.api, self.incorrectData) self.assertEqual(result, 400)
def test_noJson(self): result = create_post(self.api, self.noData) self.assertEqual(result, 400)