Exemple #1
0
    def test_scenario_has_to_run(self):
        """
            Test scenario's has to run functionality
        """
        feature = Mock(tags=[Scenario.Tag("feature_bar"), Scenario.Tag("feature_foo")])

        s = Scenario(1, "Scenario", "Some scenario", None, None, feature, [Scenario.Tag("foo", None), Scenario.Tag("bar", None), Scenario.Tag("bad_case", None)])
        s.absolute_id = 1
        s.has_to_run.when.called_with(None, None, ["foo"]).should.return_value(True)
        s.has_to_run.when.called_with(None, None, ["good_case", "foo"]).should.return_value(True)
        s.has_to_run.when.called_with(None, None, ["good_case", "bar", "bad_case"]).should.return_value(True)
        s.has_to_run.when.called_with(None, None, ["good_case"]).should.return_value(False)

        s.has_to_run.when.called_with([1], None, None).should.return_value(True)
        s.has_to_run.when.called_with([1, 2], None, None).should.return_value(True)
        s.has_to_run.when.called_with([2], None, None).should.return_value(False)

        s.has_to_run.when.called_with([1], None, ["good_case"]).should.return_value(True)
        s.has_to_run.when.called_with([1, 2], None, ["foo", "bad_case"]).should.return_value(True)
        s.has_to_run.when.called_with([5, 4], None, ["bad_case"]).should.return_value(True)
        s.has_to_run.when.called_with([6], None, ["good_case"]).should.return_value(False)

        s.has_to_run.when.called_with(None, ["feature"], None).should.return_value(False)
        s.has_to_run.when.called_with(None, ["feature_bar"], None).should.return_value(True)
        s.has_to_run.when.called_with(None, ["feature", "feature_bar"], None).should.return_value(True)
        s.has_to_run.when.called_with(None, ["feature_foo"], None).should.return_value(True)
Exemple #2
0
    def test_scenario_has_to_run(self):
        """
            Test scenario's has to run functionality
        """
        feature = Mock()

        s = Scenario(1, "Scenario", "Some scenario", None, None, feature)
        s.absolute_id = 1
        s.has_to_run.when.called_with(None).should.return_value(True)

        s.has_to_run.when.called_with([1]).should.return_value(True)
        s.has_to_run.when.called_with([1, 2]).should.return_value(True)
        s.has_to_run.when.called_with([2]).should.return_value(False)
Exemple #3
0
def test_scenario_has_to_run(scenario_id, scenario_choice,
                             expected_has_to_run):
    """
    Test logic to check whether a Scenario has to run or not
    """
    # given
    scenario = Scenario(1,
                        'Scenario',
                        'I am a Scenario',
                        'foo.feature',
                        1,
                        parent=None,
                        tags=None,
                        preconditions=None,
                        background=None)
    scenario.absolute_id = scenario_id

    # when
    actual_has_to_run = scenario.has_to_run(scenario_choice)

    # then
    assert actual_has_to_run is expected_has_to_run
Exemple #4
0
def test_scenario_has_to_run(scenario_id, scenario_choice, expected_has_to_run):
    """
    Test logic to check whether a Scenario has to run or not
    """
    # given
    scenario = Scenario(
        1,
        "Scenario",
        "I am a Scenario",
        "foo.feature",
        1,
        parent=None,
        tags=None,
        preconditions=None,
        background=None,
    )
    scenario.absolute_id = scenario_id

    # when
    actual_has_to_run = scenario.has_to_run(scenario_choice)

    # then
    assert actual_has_to_run is expected_has_to_run