Ejemplo n.º 1
0
    def test_update_iapp_template(self, *args):
        # Configure the arguments that would be sent to the Ansible module
        set_module_args(
            dict(content=load_fixture('basic-iapp.tmpl'),
                 password='******',
                 server='localhost',
                 user='******'))

        current1 = Parameters(params=load_fixture(
            'load_sys_application_template_w_new_checksum.json'))
        current2 = Parameters(params=load_fixture(
            'load_sys_application_template_w_old_checksum.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.create_on_device = Mock(return_value=True)
        mm.read_current_from_device = Mock(return_value=current1)
        mm.template_in_use = Mock(return_value=False)
        mm._get_temporary_template = Mock(return_value=current2)
        mm._remove_iapp_checksum = Mock(return_value=None)
        mm._generate_template_checksum_on_device = Mock(return_value=None)

        results = mm.exec_module()

        assert results['changed'] is True
 def test_module_parameters(self):
     args = dict(
         package='MyApp-0.1.0-0001.noarch.rpm',
         state='present'
     )
     p = Parameters(args)
     assert p.package == 'MyApp-0.1.0-0001.noarch.rpm'
Ejemplo n.º 3
0
 def test_module_parameters(self):
     iapp = load_fixture('create_iapp_template.iapp')
     args = dict(content=iapp)
     p = Parameters(params=args)
     assert p.name == 'foo.iapp'