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))
def tc_005_keyboard_shortcut_test(self): preporter.info("Opening URL: " + config.BASE_URL) self._driver.open_url(config.BASE_URL) self._home_page.navigate_to_help_tab() self._home_page.click_to_community_link() self._driver.switch_window() self._community_page.click_on_hamburger_menu() assert_true(self._community_page.is_keyboard_shortcuts_displayed(), "Keyboard shortcut button not displayed")
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))
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))
def test_002_content_follow_unfollow_workflow_from_search( self, team, competition, player): self.following_screen.follow_item(team) self.following_screen.follow_item(competition) self.following_screen.follow_item(player) follow_result = self.following_screen.get_all_following_item_names() assert_true(team and competition and player in follow_result) self.following_screen.unfollow_item(team.lower()) self.following_screen.unfollow_item(competition.lower()) self.following_screen.unfollow_item(player.lower()) unfollow_result = self.following_screen.get_all_following_item_names() assert_true(team and competition and player not in unfollow_result)
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"])
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_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)
def move_test(self): shutil.copy("D:\\Users\\Cedric\\PycharmProjects\\event-manager\\rep_test\\test_2208.txt", self.put_event_conf.directory) event = FileCreatedEvent(self.put_event_conf.directory + os.path.sep + "test_2208.txt") assert_true(self.hdfs_put_handler.on_created(event)) assert_true(self.hdfs_get_handler.process("/user/hduser/test_2208.txt")) assert_true(os.path.exists(self.get_event_conf.destination + os.path.sep + "test_2208.txt"))
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"]
def BaiduTest_001(self): self.driver.get(Test_Url) title_text = self.driver.title preporter.info('已进入百度首页并获取页面title,title值为: 「%s」' % title_text, screenshot=True) assert_true('百度一下' in title_text)
def test_006_complete_remove_favourite_nation(self): self.following_screen.clear_favourite_nation() self.following_screen.confirm_user_favourite_deletion() assert_true(self.following_screen.is_user_favourite_nation_cleared())
def compress_test(self): shutil.copy("D:\\Users\\Cedric\\PycharmProjects\\event-manager\\rep_test\\test_2208.txt", self.event_conf.directory) event = FileCreatedEvent(self.event_conf.directory + os.path.sep + "test_2208.txt") self.result = self.fs_handler.on_created(event) assert_true(os.path.exists(self.event_conf.destination + os.path.sep + "test_2208.txt.gz"))
def test_2(self, port, request): args = Namespace(port=port) server.main(args) assert_true()
def test1(self, address): args = Namespace(host=address, port=80) server.main(args) assert_true()