예제 #1
0
 def test_001_get_all_services_sanity(self):
     url = common_utils.build_resource_endpoint(BASE_ENDPOINT,
                                                SERVICES_PATH)
     response = http_util.get(url, headers=common_utils.get_basic_headers())
     assert_equals(response.status_code, 200)
     assert_true(
         common_utils.validate_schema(
             response.json(), services_schemas.services_get_all_schema))
예제 #2
0
 def test_002_get_all_services_pagination(self):
     url = common_utils.build_resource_endpoint(BASE_ENDPOINT,
                                                SERVICES_PATH)
     response = http_util.get(url, headers=common_utils.get_basic_headers())
     assert_equals(response.status_code, 200)
     assert_true(
         common_utils.validate_schema(
             response.json(), services_schemas.services_get_all_schema))
     limit = response.json()["limit"]
     url = common_utils.build_resource_endpoint(
         BASE_ENDPOINT, SERVICES_PATH) + "?$skip=" + str(limit)
     paginated_response = http_util.get(
         url, headers=common_utils.get_basic_headers())
     assert_equals(response.status_code, 200)
     assert_true(
         common_utils.validate_schema(
             response.json(), services_schemas.services_get_all_schema))
     assert_equals(paginated_response.json()["skip"], limit)
예제 #3
0
 def test_008_get_services_error(self, service):
     url = common_utils.build_resource_endpoint(BASE_ENDPOINT,
                                                SERVICES_PATH,
                                                self.testcase_data[service])
     response = http_util.get(url, headers=common_utils.get_basic_headers())
     response_json = response.json()
     assert_equals(response.status_code, 404)
     assert_true(
         common_utils.validate_schema(
             response_json, services_schemas.services_error_schema))
예제 #4
0
 def test_003_create_services_error(self, service):
     url = common_utils.build_resource_endpoint(BASE_ENDPOINT,
                                                SERVICES_PATH)
     error_payload = {"error_name": service}
     response = http_util.post(url,
                               request_json=error_payload,
                               headers=common_utils.get_basic_headers())
     response_json = response.json()
     assert_equals(response.status_code, 400)
     assert_true(
         common_utils.validate_schema(
             response_json, services_schemas.services_error_schema))
예제 #5
0
 def test_006_delete_services_success(self, service):
     url = common_utils.build_resource_endpoint(BASE_ENDPOINT,
                                                SERVICES_PATH,
                                                self.testcase_data[service])
     response = http_util.delete(url,
                                 headers=common_utils.get_basic_headers())
     response_json = response.json()
     assert_equals(response.status_code, 200)
     assert_true(
         common_utils.validate_schema(
             response_json, services_schemas.services_success_schema))
     assert_equals(str(response_json["id"]), self.testcase_data[service])
     assert_equals(service, response_json["name"])
예제 #6
0
 def test_004_create_services_success(self, service):
     url = common_utils.build_resource_endpoint(BASE_ENDPOINT,
                                                SERVICES_PATH)
     response = http_util.post(
         url,
         request_json=common_utils.create_services_payload(service),
         headers=common_utils.get_basic_headers())
     response_json = response.json()
     assert_equals(response.status_code, 201)
     assert_true(
         common_utils.validate_schema(
             response_json, services_schemas.services_success_schema))
     assert_equals(response_json["name"], service,
                   "Service name did't match")
     self.testcase_data[service] = str(response_json["id"])
 def test_001_create_service(self):
     url = common_utils.build_resource_endpoint(BASE_ENDPOINT,
                                                SERVICES_PATH)
     payload = common_utils.create_services_payload(
         data.SINGLE_USER_WORKFLOW_SERVICES[0])
     response = http_util.post(url,
                               request_json=payload,
                               headers=common_utils.get_basic_headers())
     assert_equals(response.status_code, 201)
     response_json = response.json()
     assert_true(
         common_utils.validate_schema(
             response_json, services_schemas.services_success_schema))
     assert_equals(response_json["name"],
                   data.SINGLE_USER_WORKFLOW_SERVICES[0])
     self.testcase_data[response_json["name"]] = response_json["id"]
 def test_002_get_service(self):
     url = common_utils.build_resource_endpoint(
         BASE_ENDPOINT,
         SERVICES_PATH,
         resource=str(
             self.testcase_data[data.SINGLE_USER_WORKFLOW_SERVICES[0]]))
     response = http_util.get(url, headers=common_utils.get_basic_headers())
     assert_equals(response.status_code, 200)
     response_json = response.json()
     assert_true(
         common_utils.validate_schema(
             response_json, services_schemas.services_success_schema))
     assert_equals(response_json["name"],
                   data.SINGLE_USER_WORKFLOW_SERVICES[0])
     assert_equals(
         response_json["id"],
         self.testcase_data[data.SINGLE_USER_WORKFLOW_SERVICES[0]])
    def test_003_update_service(self):
        url = common_utils.build_resource_endpoint(
            BASE_ENDPOINT,
            SERVICES_PATH,
            resource=str(
                self.testcase_data[data.SINGLE_USER_WORKFLOW_SERVICES[0]]))
        payload = common_utils.create_services_payload("updated service name")
        response = http_util.patch(url,
                                   request_json=payload,
                                   headers=common_utils.get_basic_headers())
        assert_equals(response.status_code, 200)
        response_json = response.json()
        assert_true(
            common_utils.validate_schema(
                response_json, services_schemas.services_success_schema))
        assert_equals(
            response_json["id"],
            self.testcase_data[data.SINGLE_USER_WORKFLOW_SERVICES[0]])
        assert_equals(response_json["name"], "updated service name",
                      "Updated name did't match")

        # Performing a get call to check if the resource got updated properly
        get_response = http_util.get(url,
                                     headers=common_utils.get_basic_headers())
        get_response_json = get_response.json()
        assert_equals(
            get_response_json["id"],
            self.testcase_data[data.SINGLE_USER_WORKFLOW_SERVICES[0]])
        assert_equals(get_response_json["name"], "updated service name",
                      "Updated name did't match")

        # updating the data back to original to maintain state
        payload = common_utils.create_services_payload(
            data.SINGLE_USER_WORKFLOW_SERVICES[0])
        update_response = http_util.patch(
            url,
            request_json=payload,
            headers=common_utils.get_basic_headers())
        self.testcase_data[update_response.json()
                           ["name"]] = response_json["id"]