def test_create_and_check_template_list(self): params = { 'file_name': YamlTemplateData.file_yaml.value.name, 'data': YamlTemplateData.file_yaml.value.data, } upload_template(file_name=params['file_name'], file=params['data']) short_name = extract_name(params['file_name']) response = get_templates_list() assert short_name.encode() in response.content
def test_create_install_and_delete_template_without_data(self): params = { 'file_name': YamlTemplateData.file_right_short.value.name, 'data': YamlTemplateData.file_right_short.value.data, } upload_template(file_name=params['file_name'], file=params['data']) short_name = extract_name(params['file_name']) install_template(short_name) delete_template(short_name) response = get_templates_list() assert short_name.encode() not in response.content
def test_success_delete_template(self): params = { 'file_name': YamlTemplateData.file_yaml.value.name, 'data': YamlTemplateData.file_yaml.value.data, } upload_template(file_name=params['file_name'], file=params['data']) short_name = extract_name(params['file_name']) response = delete_template(short_name) assert response.status_code == 200 assert ast.literal_eval( response.text )['message'] == f'Template with tmpl_id={short_name} successfully deleted!'
def test_delete_all_templates(self): params = { 'file_name_1': YamlTemplateData.file_yaml.value.name, 'data_1': YamlTemplateData.file_yaml.value.data, 'file_name_2': YamlTemplateData.file_right_short.value.name, 'data_2': YamlTemplateData.file_right_short.value.data, } upload_template(file_name=params['file_name_1'], file=params['data_1']) upload_template(file_name=params['file_name_2'], file=params['data_2']) delete_all_templates() response = get_templates_list() assert not extract_templates_list(response.content)
def test_create_install_and_delete_template_with_data(self): params = { 'file_name': YamlTemplateData.file_right_short.value.name, 'data': YamlTemplateData.file_right_short.value.data, 'tmpl_id': str(random.randint(1, 10000000)), } upload_template(file_name=params['file_name'], file=params['data'], data={'tmpl_id': params['tmpl_id']}) short_name = extract_name(params['file_name']) install_template(short_name) delete_template(short_name) response = get_templates_list() assert short_name.encode() not in response.content
def set_template(name, data): upload_template(file_name=name, file=data) short_name = extract_name(name) install_template(short_name)
def test_put_with_big_name_file(self): response = upload_template(file_name=generate_random_string(1000), file=YamlTemplateData.file_yaml.value.data) assert response.status_code == 400
def test_put_with_big_file(self): response = upload_template( file_name=YamlTemplateData.file_right_big.value.name, file=YamlTemplateData.file_right_big.value.data) assert response.status_code == 413
def test_put_with_empty_name_file(self): response = upload_template(file_name='', file=YamlTemplateData.file_yaml.value.data) assert response.status_code == 400
def test_put_with_file_another_format(self, file, data): response = upload_template(file_name=file, file=data) assert response.status_code == 400
def test_success_put_without_id(self): response = upload_template( file_name=YamlTemplateData.file_yaml.value.name, file=YamlTemplateData.file_yaml.value.data) assert response.status_code == 201
def test_success_put_with_file_and_id(self): response = upload_template( file_name=YamlTemplateData.file_yaml.value.name, file=YamlTemplateData.file_yaml.value.data, data={'tmpl_id': str(random.randint(1, 10000000))}) assert response.status_code == 201
def test_success_install_template(self, file, data): upload_template(file_name=file, file=data) short_name = extract_name(file) response = install_template(short_name) assert response.status_code == 200