def test_modify_ha_order(self, *args): set_module_args( dict(name='traffic-group-2', ha_order=['v12-2.ansible.local', 'v12-1.ansible.local'], provider=dict(server='localhost', password='******', user='******'))) module = AnsibleModule( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode, ) current = ApiParameters(params=load_fixture('load_tg_ha_order.json')) mm = ModuleManager(module=module) mm.exists = Mock(return_value=True) mm.read_current_from_device = Mock(return_value=current) mm.update_on_device = Mock(return_value=True) results = mm.exec_module() assert results['changed'] is True assert results['ha_order'] == [ '/Common/v12-2.ansible.local', '/Common/v12-1.ansible.local' ]
def test_create(self, *args): set_module_args( dict(name='foo', provider=dict(server='localhost', password='******', user='******'))) module = AnsibleModule( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode) mm = ModuleManager(module=module) mm.create_on_device = Mock(return_value=True) mm.exists = Mock(return_value=False) results = mm.exec_module() assert results['changed'] is True