def test_run_single_command(self, *args):
        set_module_args(
            dict(save='yes',
                 reset='yes',
                 merge_content='asdasd',
                 verify='no',
                 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)

        # Override methods to force specific logic in the module to happen
        mm.exit_json = Mock(return_value=True)
        mm.reset_device = Mock(return_value='reset output')
        mm.upload_to_device = Mock(return_value=True)
        mm.move_on_device = Mock(return_value=True)
        mm.merge_on_device = Mock(return_value='merge output')
        mm.remove_temporary_file = Mock(return_value=True)
        mm.save_on_device = Mock(return_value='save output')

        results = mm.exec_module()

        assert results['changed'] is True
Exemplo n.º 2
0
    def test_run_single_command(self, *args):
        set_module_args(dict(
            save='yes',
            reset='yes',
            merge_content='asdasd',
            verify='no',
            server='localhost',
            user='******',
            password='******'
        ))

        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.exit_json = Mock(return_value=True)
        mm.reset_device = Mock(return_value='reset output')
        mm.upload_to_device = Mock(return_value=True)
        mm.move_on_device = Mock(return_value=True)
        mm.merge_on_device = Mock(return_value='merge output')
        mm.remove_temporary_file = Mock(return_value=True)
        mm.save_on_device = Mock(return_value='save output')

        results = mm.exec_module()

        assert results['changed'] is True