Example #1
0
    def test_prepare_failing_feature_verbose_0(self, mock_feature, mock_prepare_border,
                                               mock_prepare_step, mock_prepare_scenario, mock_prepare_exception, cyan_mock, red_mock):
        display = Display()
        display.verbosity_level = 0

        mock_feature.description = 'Mock Feature'
        mock_feature.passed = False
        mock_feature.exception = 'FooBarException'
        mock_feature.scenarios = ['scenario_one', 'scenario_two']
        mock_feature.before_all = ['before_all_one', 'before_all_two']
        mock_feature.after_all = ['after_all']
        mock_feature.before_each = ['before_each']
        mock_feature.after_each = ['after_each_one', 'after_each_two']

        display.prepare_feature(mock_feature)

        cyan_mock.assert_not_called()
        red_mock.assert_called_once_with("Feature: Mock Feature")

        display.prepare_step.assert_any_call('before_all_one', 'BeforeAll')
        display.prepare_step.assert_any_call('before_all_two', 'BeforeAll')
        display.prepare_step.assert_any_call('after_all', 'AfterAll')
        display.prepare_step.assert_any_call('before_each', 'BeforeEach')
        display.prepare_step.assert_any_call('after_each_one', 'AfterEach')
        display.prepare_step.assert_any_call('after_each_two', 'AfterEach')

        display.prepare_scenario.assert_any_call('scenario_one')
        display.prepare_scenario.assert_any_call('scenario_two')
        display.prepare_exception.assert_called_once_with('FooBarException')

        self.assertEqual(display.display_string,
                         "="*150 + "\n" + "Feature: Mock Feature\n" + "="*150 + "\n")
Example #2
0
    def test_prepare_passing_feature_verbose_1(self, mock_feature, mock_prepare_border,
                                               mock_prepare_scenario, mock_prepare_exception, cyan_mock, red_mock):
        display = Display()
        display.verbosity_level = 1

        mock_feature.description = 'Mock Feature'
        mock_feature.passed = True
        mock_feature.exception = None
        mock_feature.scenarios = ['scenario_one', 'scenario_two']

        display.prepare_feature(mock_feature)

        cyan_mock.assert_called_once_with("Feature: Mock Feature")
        red_mock.assert_not_called()
        display.prepare_scenario.assert_any_call('scenario_one')
        display.prepare_scenario.assert_any_call('scenario_two')
        display.prepare_exception.assert_not_called()

        self.assertEqual(display.display_string,
                         "="*150 + "\n" + "Feature: Mock Feature\n" + "="*150 + "\n")
Example #3
0
    def test_prepare_passing_feature_verbose_0(self, mock_feature):
        display = Display()
        display.prepare_feature(mock_feature)

        self.assertEqual(display.display_string, "")