Ejemplo n.º 1
0
    def test_should_get_custom_attributes(self):
        self.resource.get_by.return_value = [OS_DEPLOYMENT_PLAN]

        self.mock_ansible_module.params = PARAMS_GET_OPTIONS

        OsDeploymentPlanFactsModule().run()

        self.mock_ansible_module.exit_json.assert_called_once_with(
            changed=False,
            ansible_facts={
                'os_deployment_plans': [OS_DEPLOYMENT_PLAN],
                'os_deployment_plan_custom_attributes': {
                    'os_custom_attributes_for_server_profile': [{
                        'name':
                        'name1',
                        'value':
                        'value1'
                    }, {
                        'name':
                        'name3',
                        'value':
                        'value3'
                    }]
                }
            })
Ejemplo n.º 2
0
    def test_should_get_os_deployment_plan_by_name(self):
        self.resource.get_by.return_value = [{"Os Deployment Plan Name"}]

        self.mock_ansible_module.params = PARAMS_GET_BY_NAME

        OsDeploymentPlanFactsModule().run()

        self.mock_ansible_module.exit_json.assert_called_once_with(
            changed=False,
            ansible_facts=dict(
                os_deployment_plans=([{"Os Deployment Plan Name"}])))
Ejemplo n.º 3
0
    def test_should_get_custom_attributes_without_editable(self):
        self.resource.get_by.return_value = [
            OS_DEPLOYMENT_PLAN_WITHOUT_EDITABLE
        ]

        self.mock_ansible_module.params = PARAMS_GET_OPTIONS

        OsDeploymentPlanFactsModule().run()

        self.mock_ansible_module.exit_json.assert_called_once_with(
            changed=False,
            ansible_facts={
                'os_deployment_plans': [OS_DEPLOYMENT_PLAN_WITHOUT_EDITABLE],
                'os_deployment_plan_custom_attributes': {
                    'os_custom_attributes_for_server_profile': []
                }
            })
Ejemplo n.º 4
0
    def test_should_get_custom_attributes_with_nic_support(self):
        self.resource.get_by.return_value = [OS_DEPLOYMENT_PLAN_WITH_NIC]

        self.mock_ansible_module.params = PARAMS_GET_OPTIONS

        OsDeploymentPlanFactsModule().run()

        exit_json_args = self.mock_ansible_module.exit_json.call_args[1]
        expected_args = dict(changed=False,
                             ansible_facts={
                                 'os_deployment_plans':
                                 [OS_DEPLOYMENT_PLAN_WITH_NIC],
                                 'os_deployment_plan_custom_attributes': {
                                     'os_custom_attributes_for_server_profile':
                                     [{
                                         'name': 'name1',
                                         'value': 'value1'
                                     }, {
                                         'name': 'name3',
                                         'value': 'value3'
                                     }, {
                                         'name': 'name1.dhcp',
                                         'value': False
                                     }, {
                                         'name': 'name1.constraint',
                                         'value': 'auto'
                                     }, {
                                         'name': 'name1.connectionid',
                                         'value': ''
                                     }, {
                                         'name': 'name1.networkuri',
                                         'value': ''
                                     }, {
                                         'name': 'name1.ipv4disable',
                                         'value': False
                                     }]
                                 }
                             })

        # Using ResourceComparator due to random list ordering of the Python 3
        self.assertTrue(
            ResourceComparator.compare(exit_json_args, expected_args))