def test_update_vlan_untag_interface(self, *args): set_module_args( dict(name='somevlan', untagged_interface=['2.1'], partition='Common', provider=dict(server='localhost', password='******', user='******'))) module = AnsibleModule( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode, mutually_exclusive=self.spec.mutually_exclusive) # Override methods to force specific logic in the module to happen mm = ModuleManager(module=module) current = ApiParameters(params=load_fixture('load_vlan.json')) interfaces = load_fixture('load_vlan_interfaces.json') current.update({'interfaces': interfaces}) mm.update_on_device = Mock(return_value=True) mm.exists = Mock(return_value=True) mm.read_current_from_device = Mock(return_value=current) results = mm.exec_module() assert results['changed'] is True assert results['untagged_interfaces'] == ['2.1']
def test_update_vlan_untag_interface(self, *args): set_module_args(dict( name='somevlan', untagged_interface=['2.1'], server='localhost', password='******', user='******', partition='Common', )) module = AnsibleModule( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode ) # Override methods to force specific logic in the module to happen mm = ModuleManager(module=module) current = ApiParameters(params=load_fixture('load_vlan.json')) interfaces = load_fixture('load_vlan_interfaces.json') current.update({'interfaces': interfaces}) mm.update_on_device = Mock(return_value=True) mm.exists = Mock(return_value=True) mm.read_current_from_device = Mock(return_value=current) results = mm.exec_module() assert results['changed'] is True assert results['untagged_interfaces'] == ['2.1']
def test_update_vlan_description(self, *args): set_module_args( dict( name='somevlan', description='changed_that', server='localhost', password='******', user='******', partition='Common', )) module = AnsibleModule( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode) # Override methods to force specific logic in the module to happen mm = ModuleManager(module=module) current = ApiParameters( params=load_fixture('update_vlan_description.json')) mm.update_on_device = Mock(return_value=True) mm.exists = Mock(return_value=True) mm.read_current_from_device = Mock(return_value=current) results = mm.exec_module() assert results['changed'] is True assert results['description'] == 'changed_that'
def test_api_parameters(self): args = dict(name='somevlan', description='fakevlan', tag=213) p = ApiParameters(params=args) assert p.name == 'somevlan' assert p.tag == 213 assert p.description == 'fakevlan'