Пример #1
0
    def test_should_create_new_build_plan(self):
        self.resource.get_by.return_value = []
        self.resource.create.return_value = {"name": "name"}

        self.mock_ansible_module.params = self.BUILD_PLAN_CREATE

        BuildPlanModule().run()

        self.resource.create.assert_called_once_with({
            'name':
            'Demo OS Build Plan',
            'description':
            "oebuildplan",
            'oeBuildPlanType':
            "deploy"
        })

        self.mock_ansible_module.exit_json.assert_called_once_with(
            changed=True,
            msg=BuildPlanModule.MSG_CREATED,
            ansible_facts=dict(build_plan={"name": "name"}))