Exemple #1
0
    def testPlaybookOnTaskStart_DirtyFlagSetAndCoverageSkip_NotRunServerspec(self, mock_subprocess):
        callbacks = CallbackModule()
        callbacks.playbook_on_start()
        callbacks.dirty = True
        callbacks.playbook_on_task_start('it\'s me [coverage_skip]', False)

        self.assertEqual(callbacks.num_failed_tests, 2)
        self.assertEqual(callbacks.dirty, True)
Exemple #2
0
    def testRunnerOnOk_ChangedAndNotTestedTask_AddToFailTasks(self, mock_stdout, mock_subprocess):
        callbacks = CallbackModule()
        callbacks.playbook_on_start()
        callbacks.playbook_on_task_start('it\'s me', False)
        callbacks.runner_on_ok('localhost', {'changed': True})

        self.assertEqual(callbacks.num_tested_tasks, 0)
        self.assertEqual(callbacks.not_tested_tasks, ['it\'s me'])
Exemple #3
0
    def testPlaybookOnTaskStart_DirtyFlagSet_RunServerspec(self, mock_subprocess):
        callbacks = CallbackModule()
        callbacks.playbook_on_start()
        callbacks.dirty = True
        callbacks.playbook_on_task_start('it\'s me', False)

        self.assertEqual(callbacks.num_failed_tests, 1)
        self.assertEqual(callbacks.dirty, False)
Exemple #4
0
    def testPlaybookOnStats_DirtyFlagSet_RunServerspec(self, mock_stdout, mock_subprocess):
        callbacks = CallbackModule()
        callbacks.playbook_on_start()
        callbacks.playbook_on_task_start('it\'s me [coverage_skip]', False)
        callbacks.runner_on_ok('localhost', {'changed': True})
        callbacks.playbook_on_stats(None)

        self.assertEqual(callbacks.num_failed_tests, 1)
        self.assertEqual(callbacks.dirty, False)
Exemple #5
0
    def testRunnerOnOk_CoverageSkipTask_NotIncNumChangedTasks(self, mock_subprocess):
        callbacks = CallbackModule()
        callbacks.playbook_on_start()
        callbacks.playbook_on_task_start('it\'s me (coverage_skip)', False)
        callbacks.runner_on_ok('localhost', {'changed': True})

        self.assertEqual(callbacks.dirty, True)
        # since serverspec is not run, # of failed tests should not be updated
        self.assertEqual(callbacks.num_failed_tests, 2)
Exemple #6
0
    def testRunnerOnOk_ChangedAndNotTestedTask_ShowTestedBy(self, mock_stdout, mock_subprocess):
        callbacks = CallbackModule()
        callbacks.playbook_on_start()
        callbacks.playbook_on_task_start('it\'s me', False)
        callbacks.runner_on_ok('localhost', {'changed': True})

        result = mock_stdout.getvalue()
        self.assertIn('tested by:', result)
        self.assertNotIn('rspec', result)
Exemple #7
0
    def testPlaybookOnStats_NoTestedTask_Coverage0(self, mock_stdout, mock_subprocess):
        callbacks = CallbackModule()
        callbacks.playbook_on_start()
        callbacks.playbook_on_task_start('it\'s me', False)
        callbacks.runner_on_ok('localhost', {'changed': True})
        callbacks.playbook_on_stats(None)

        result = mock_stdout.getvalue()
        self.assertIn(' 0%', result)
        self.assertIn('it\'s me', result)
        self.assertIn('WARNING:', result)
Exemple #8
0
    def testPlaybookOnTaskStart_KirbyIsEnabled_TaskNameSet(self, mock_subprocess):
        callbacks = CallbackModule()
        callbacks.playbook_on_start()
        callbacks.playbook_on_task_start('it\'s me', False)

        self.assertEqual(callbacks.curr_task_name, 'it\'s me')