Esempio n. 1
0
    def do_request(self, http_type, input_endpoint, data_table, id_dictionary):
        logger.info("METHOD: " + http_type)
        logger.info("ENDPOINT: " + input_endpoint)
        logger.info("DATATABLE: %s", data_table)
        logger.info("DICTIONARY: %s", id_dictionary)
        data = self.generate_data(data_table, id_dictionary)

        body_content = json.dumps(data)
        logger.debug("BODY: %s", body_content)
        url_value = self.url + self.replace_variables(input_endpoint,
                                                      id_dictionary)
        HEADERS = {'content-type': 'application/json'}

        logger.debug("HEADERS: %s", HEADERS)

        if http_type == 'GET' or http_type == 'DELETE':
            self.response = requests.request(http_type,
                                             url_value,
                                             params=self.params_credentials)
            verify_logger(self.response)
        else:
            self.response = requests.request(http_type,
                                             url_value,
                                             data=body_content,
                                             headers=HEADERS,
                                             params=self.params_credentials)
            verify_logger(self.response)
        return self.response
Esempio n. 2
0
def before_scenario(context, scenario):
    context.id_dictionary = {}
    context.cleaner_list = []
    context.request_api = RequestApi()
    logger.info("START: %s", scenario)
Esempio n. 3
0
def after_feature(context, feature):
    logger.info("END: %s", feature)
Esempio n. 4
0
def before_feature(context, feature):
    logger.info("START: %s", feature)
Esempio n. 5
0
def after_scenario(context, scenario):
    logger.info("END: %s", scenario)
    status_code_list = context.request_api.delete_object(context.cleaner_list)
    for status_code in status_code_list:
        assert status_code == 200