def test_valid_query_subset_value(self, get_location_search_api_url, location_search_query_subset_param): """ Test to verify if location details received is as per expected result for metaweather api Location Search, on passing a subset of valid city name. """ self.log.info( ("*" * 40) + " test_valid_query_subset_value " + ("*" * 40)) # Reading from conftest value for query parameter i.e. city name subset query = location_search_query_subset_param # Reading from the JSON validator file data_response = readJson( "location_search/valid_subset_query_parameter") self.log.info("\nExpected Response:\n %s", data_response[query]) # Getting the response after making GET API call response = ops.get(url=get_location_search_api_url, params={'query': query} ) self.log.info( "\nActual Response:\nResponse Code: %s \nResponse Body: %s", response.status_code, response.json()) allure.dynamic.description( "Response time for the request is: " + str(response.elapsed.total_seconds())) assert response.status_code == requests.codes.ok and \ response.json() == data_response[query]
def test_valid_woeid_date(self, get_location_api_url, get_valid_date, get_valid_woeid): """ Test to verify if Weather Details are fetched for the passed woeid & date, and if it matches with test data present in json. """ self.log.info(("*" * 40) + " test_valid_woeid_date " + ("*" * 40)) # Reading from conftest value for woeid & date woeid = get_valid_woeid date =get_valid_date # Reading from the JSON validator file data_response = readJson(f"location_day/{woeid}") # Getting the response after making GET API call response = ops.get(url=get_location_api_url, woeid=woeid, date=date ) self.log.info( "\nActual Response:\nResponse Code: %s", response.status_code) allure.dynamic.description( "Response time for the request is: " + str(response.elapsed.total_seconds())) assert response.status_code == requests.codes.ok and \ response.json() == data_response[date]
def test_valid_lattlong_value(self, get_location_search_api_url, location_search_lattlong_valid): """ Test to verify if location details received is as per expected result for metaweather api Location Search, on passing valid latitudes & longitudes. """ self.log.info(("*" * 40) + " test_valid_lattlong_value " + ("*" * 40)) # Reading from conftest value for lattlong parameter # i.e. latitude & longitude values lattlong = location_search_lattlong_valid # Reading from the JSON validator file data_response = readJson("location_search/valid_lattlong_parameters") self.log.info("\nExpected Response:\n %s", data_response[lattlong]) # Getting the response after making GET API call response = ops.get(url=get_location_search_api_url, params={'lattlong': lattlong} ) self.log.info( "\nActual Response:\nResponse Code: %s \nResponse Body: %s", response.status_code, response.json()) allure.dynamic.description( "Response time for the request is: " + str(response.elapsed.total_seconds())) assert response.status_code == requests.codes.ok and \ response.json() == data_response[lattlong]
def pageLocators(self, page): """ read the locators of specific page :param page: page :return: list of all locators in specific page """ locatorsPath = os.path.abspath("./locators/locators.json") locatorsJsonFile = RJ.readJson(locatorsPath) pageLocators = [ locator for locator in locatorsJsonFile if locator['pageName'] in page ] return pageLocators
def pageLocators(self, page): """ read the locators of specific page :param page: page :return: list of all locators in specific page """ locatorsPath = os.path.abspath( "/Users/karthickdhivya/Documents/GitHub/Python-Test-Automation-Framework/locators/locators.json" ) locatorsJsonFile = RJ.readJson(locatorsPath) pageLocators = [ locator for locator in locatorsJsonFile if locator['pageName'] in page ] return pageLocators
def testData(attribute): testDataPath = os.path.abspath("./test_data/test_data.json") testDataJsonFile = RJ.readJson(testDataPath) return testDataJsonFile[attribute]
def testData(attribute): testDataPath = os.path.abspath( "/Users/karthickdhivya/Documents/GitHub/Python-Test-Automation-Framework/test_data/test_data.json" ) testDataJsonFile = RJ.readJson(testDataPath) return testDataJsonFile[attribute]