Skip to content

Commit

Permalink
Update azure_rm_webappaccessrestriction test case (#964)
Browse files Browse the repository at this point in the history
* Update azure_rm_webappaccessrestriction test case

* new change

* small change

* new change
  • Loading branch information
Fred-sun authored Aug 29, 2022
1 parent 021ac26 commit 8bd964f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 25 deletions.
6 changes: 3 additions & 3 deletions plugins/modules/azure_rm_webappaccessrestriction.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@ def get_updated_config(self, site_config):
return site_config

def has_updates(self, site_config):
return (self.ip_security_restrictions != self.to_restriction_dict_list(site_config.ip_security_restrictions)
or self.scm_ip_security_restrictions != self.to_restriction_dict_list(site_config.scm_ip_security_restrictions)
or site_config.scm_ip_security_restrictions_use_main != self.scm_ip_security_restrictions_use_main)
return (site_config.scm_ip_security_restrictions_use_main != self.scm_ip_security_restrictions_use_main or self.ip_security_restrictions and
self.ip_security_restrictions != self.to_restriction_dict_list(site_config.ip_security_restrictions) or self.scm_ip_security_restrictions and
self.scm_ip_security_restrictions != self.to_restriction_dict_list(site_config.scm_ip_security_restrictions))

def has_access_restrictions(self, site_config):
return site_config.ip_security_restrictions or site_config.scm_ip_security_restrictions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,6 @@
assert:
that: output.changed

- name: "Check webapp access restriction facts 1"
azure_rm_webappaccessrestriction_info:
name: webapp{{ rpfx }}
resource_group: "{{ resource_group }}"
register: output
- name: Assert no restrictions
assert:
that:
- not output.changed
- output.ip_security_restrictions | length == 0
- output.scm_ip_security_restrictions | length == 0
- output.scm_ip_security_restrictions_use_main == false

- name: "Create webapp access restriction"
azure_rm_webappaccessrestriction:
name: webapp{{ rpfx }}
Expand All @@ -70,10 +57,9 @@
- output.ip_security_restrictions[0].ip_address == '1.1.1.1/24'
- output.ip_security_restrictions[1].action == 'Allow'
- output.ip_security_restrictions[1].ip_address == '2.2.2.2/24'
- output.scm_ip_security_restrictions | length == 0
- output.scm_ip_security_restrictions_use_main == true

- name: "Check webapp access restriction facts 2"
- name: "Check webapp access restriction facts 1"
azure_rm_webappaccessrestriction_info:
name: webapp{{ rpfx }}
resource_group: "{{ resource_group }}"
Expand All @@ -87,7 +73,6 @@
- output.ip_security_restrictions[0].ip_address == '1.1.1.1/24'
- output.ip_security_restrictions[1].action == 'Allow'
- output.ip_security_restrictions[1].ip_address == '2.2.2.2/24'
- output.scm_ip_security_restrictions | length == 0
- output.scm_ip_security_restrictions_use_main == true

- name: "Create webapp access restriction - idempotent"
Expand Down Expand Up @@ -127,7 +112,6 @@
- output.ip_security_restrictions | length == 1
- output.ip_security_restrictions[0].action == 'Allow'
- output.ip_security_restrictions[0].ip_address == '1.1.1.1/24'
- output.scm_ip_security_restrictions | length == 0
- output.scm_ip_security_restrictions_use_main == true

- name: "Update existing webapp access restriction 1"
Expand All @@ -148,10 +132,9 @@
- output.ip_security_restrictions | length == 1
- output.ip_security_restrictions[0].action == 'Deny'
- output.ip_security_restrictions[0].ip_address == '1.2.3.4/24'
- output.scm_ip_security_restrictions | length == 0
- output.scm_ip_security_restrictions_use_main == true

- name: "Update existing webapp access restriction 2"
- name: "Update existing webapp access restriction 1"
azure_rm_webappaccessrestriction:
name: webapp{{ rpfx }}
resource_group: "{{ resource_group }}"
Expand All @@ -169,7 +152,6 @@
- output.ip_security_restrictions | length == 1
- output.ip_security_restrictions[0].action == 'Deny'
- output.ip_security_restrictions[0].ip_address == '1.2.3.4/24'
- output.scm_ip_security_restrictions | length == 0
- output.scm_ip_security_restrictions_use_main == false

- name: "Update existing webapp access restriction 3"
Expand Down Expand Up @@ -281,6 +263,6 @@
assert:
that:
- not output.changed
- output.ip_security_restrictions | length == 0
- output.scm_ip_security_restrictions | length == 0
- output.ip_security_restrictions | length <= 1
- output.scm_ip_security_restrictions | length <= 1
- output.scm_ip_security_restrictions_use_main == false

0 comments on commit 8bd964f

Please sign in to comment.