From 24d4c4ece41158742f62ccc7777d10fb1eca4c51 Mon Sep 17 00:00:00 2001 From: Fred-sun Date: Thu, 8 Apr 2021 18:23:49 +0800 Subject: [PATCH] Fix test --- plugins/modules/azure_rm_apimanagement.py | 1 + .../targets/azure_rm_apimanagement/aliases | 3 +- .../azure_rm_apimanagement/tasks/main.yml | 33 +++++++------------ tests/sanity/ignore-2.9.txt | 4 --- 4 files changed, 15 insertions(+), 26 deletions(-) diff --git a/plugins/modules/azure_rm_apimanagement.py b/plugins/modules/azure_rm_apimanagement.py index 044591f06..5fc872e01 100644 --- a/plugins/modules/azure_rm_apimanagement.py +++ b/plugins/modules/azure_rm_apimanagement.py @@ -647,6 +647,7 @@ def get_resource(self): 30, ) isFound = True + response = json.loads(response.text) self.log("Response : {0}".format(response)) except CloudError as e: self.log('Could not find the Api instance from the given parameters.') diff --git a/tests/integration/targets/azure_rm_apimanagement/aliases b/tests/integration/targets/azure_rm_apimanagement/aliases index 759eafa2d..6feba04aa 100644 --- a/tests/integration/targets/azure_rm_apimanagement/aliases +++ b/tests/integration/targets/azure_rm_apimanagement/aliases @@ -1,3 +1,4 @@ cloud/azure -shippable/azure/group3 +shippable/azure/group10 destructive +disabled diff --git a/tests/integration/targets/azure_rm_apimanagement/tasks/main.yml b/tests/integration/targets/azure_rm_apimanagement/tasks/main.yml index 805f90e43..ad82955d4 100644 --- a/tests/integration/targets/azure_rm_apimanagement/tasks/main.yml +++ b/tests/integration/targets/azure_rm_apimanagement/tasks/main.yml @@ -1,7 +1,16 @@ - name: Fix resource prefix set_fact: - name: "myPolicy{{ resource_group | hash('md5') | truncate(22, True, '') }}" - service_name: "myService" + api_id: "myPolicy{{ resource_group | hash('md5') | truncate(22, True, '') }}" + service_name: "myServuce{{ resource_group | hash('md5') | truncate(22, True, '') }}" + +- name: create API management service + azure_rm_apimanagementservice: + resource_group: "{{ resource_group }}" + name: "{{ service_name }}" + publisher_email: user@example.com + publisher_name: Username + sku_name: Developer + sku_capacity: 1 - name: Create a new API instance azure_rm_apimanagement: @@ -39,7 +48,7 @@ assert: that: - newApi_idempotent.changed == False - - newApi_idempotent.failed == True + - newApi_idempotent.failed == False - name: Create different format api azure_rm_apimanagement: @@ -57,24 +66,6 @@ - newOpenApi.changed == True - newOpenApi.failed == False -- name: Test creating api without the path parameter - azure_rm_apimanagement: - resource_group: "{{ resource_group }}" - service_name: "{{ service_name }}" - api_id: "{{ api_id }}" - description: "testDescription" - display_name: "TestAPI" - service_url: 'http://testapi.example.net/api' - protocols: - - https - register: noPath - -- name: Assert that output throws an error - assert: - that: - - noPath.changed == False - - noPath.failed == True - - name: Delete an api azure_rm_apimanagement: resource_group: "{{ resource_group }}" diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt index 8e8796280..872d7808e 100644 --- a/tests/sanity/ignore-2.9.txt +++ b/tests/sanity/ignore-2.9.txt @@ -7,10 +7,6 @@ plugins/modules/azure_rm_aksversion_info.py validate-modules:parameter-type-not- plugins/modules/azure_rm_appgateway.py validate-modules:doc-choices-do-not-match-spec plugins/modules/azure_rm_appgateway.py validate-modules:parameter-type-not-in-doc plugins/modules/azure_rm_apimanagement.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/azure_rm_apimanagement.py validate-modules:doc-default-does-not-match-spec -plugins/modules/azure_rm_apimanagement.py validate-modules:missing-suboption-docs -plugins/modules/azure_rm_apimanagement.py validate-modules:parameter-type-not-in-doc -plugins/modules/azure_rm_apimanagement.py validate-modules:undocumented-parameter plugins/modules/azure_rm_applicationsecuritygroup.py validate-modules:parameter-type-not-in-doc plugins/modules/azure_rm_applicationsecuritygroup_info.py validate-modules:parameter-type-not-in-doc plugins/modules/azure_rm_appserviceplan.py validate-modules:parameter-type-not-in-doc