def test_create_selfip_idempotent(self, *args): set_module_args( dict(address='10.10.10.10', allow_service=['tcp:80', 'udp:53', 'gre'], name='net1', netmask='255.255.255.0', partition='Common', route_domain='1', state='present', traffic_group='traffic-group-local-only', vlan='net1', password='******', server='localhost', user='******')) current = ApiParameters(params=load_fixture('load_tm_net_self.json')) module = AnsibleModule( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode) mm = ModuleManager(module=module) # Override methods to force specific logic in the module to happen mm.exists = Mock(side_effect=[True, True]) mm.read_current_from_device = Mock(return_value=current) results = mm.exec_module() assert results['changed'] is False
def test_api_parameters(self): args = dict(address='10.10.10.10%1/24', allowService=['tcp:80', 'udp:53', 'gre'], name='net1', state='present', trafficGroup='/Common/traffic-group-local-only', vlan='net1') p = ApiParameters(params=args) assert p.address == '10.10.10.10%1/24' assert p.allow_service == ['gre', 'tcp:80', 'udp:53'] assert p.name == 'net1' assert p.netmask == 24 assert p.traffic_group == '/Common/traffic-group-local-only' assert p.vlan == '/Common/net1'