def test__main__register_job__custom_start_time(self):
        self.load_module_args(start_time="04:15")
        # => Configure Patchers
        patch_list = self.patch__methods()

        source_list = self.set__default__return()
        source_list.update(dict(
            start_time=dict(
                hour="04",
                minute="15"
            )
        ))

        register_patcher = patch_list['register_patcher']
        register_patcher.stop()
        mock_check = register_patcher.start()
        mock_check.return_value = source_list

        with self.assertRaises(AnsibleExitJson) as exc:
            cohesity_job.main()

        return_time = dict(
            hour="04",
            minute="15"
        )

        result = exc.exception.args[0]
        self.assertEqual(result['changed'], True, result)
        self.assertEqual(
            result['msg'], 'Registration of Cohesity Protection Job Complete', result)
        self.assertEqual(result['start_time'],
                         return_time, [result, return_time])

        self.unload_patchers(patch_list)
    def test__main__stop_job__not_running(self):
        self.load_module_args(state="stopped")
        # => Configure Patchers
        patch_list = self.patch__methods(reg_return=1)

        with self.assertRaises(AnsibleExitJson) as exc:
            cohesity_job.main()

        result = exc.exception.args[0]
        self.assertEqual(result['changed'], True, result)
        self.assertEqual(
            result['msg'], 'The Protection Job for this host has been stopped', result)
    def test__main__unregister_job__no_change(self):
        self.load_module_args(state="absent")
        # => Configure Patchers
        patch_list = self.patch__methods(reg_return=False)

        with self.assertRaises(AnsibleExitJson) as exc:
            cohesity_job.main()

        result = exc.exception.args[0]
        self.assertEqual(result['changed'], False, result)
        self.assertEqual(result[
                         'msg'], 'The Protection Job for this host is currently not registered', result)

        self.unload_patchers(patch_list)
    def test__main__unregister_job__physical(self):
        self.load_module_args(state="absent")
        # => Configure Patchers
        patch_list = self.patch__methods(reg_return=1)

        with self.assertRaises(AnsibleExitJson) as exc:
            cohesity_job.main()

        result = exc.exception.args[0]
        self.assertEqual(result['changed'], True, result)
        self.assertEqual(
            result['msg'], 'Unregistration of Cohesity Protection Job Complete', result)

        self.unload_patchers(patch_list)
    def test__main__register_job__custom_start_time_error(self):
        self.load_module_args(start_time="04:150")
        # => Configure Patchers
        patch_list = self.patch__methods()

        with self.assertRaises(AnsibleFailJson) as exc:
            cohesity_job.main()

        return_time = dict(
            hour="04",
            minute="15"
        )

        result = exc.exception.args[0]
        self.assertTrue(result['failed'], result)
        assert cohesity___reg_verify__helper(
            '.+(Please review and submit the correct Protection Job Starting time).+').__check__(str(result))

        self.unload_patchers(patch_list)