Esempio n. 1
0
    def test_registering_errornous_step_with_decorator(self):
        """
            Test registering a step with an invalid regex over decorator
        """
        def step_a():
            pass

        step("[[").when.called_with(step_a).should.throw(StepRegexError, "Cannot compile regex '[[' from step 'step_a': unexpected end of regular expression")
Esempio n. 2
0
    def test_registering_steps_with_decorator(self):
        """
            Test registering steps with decorator
        """
        registry = StepRegistry()
        registry.steps.should.have.length_of(0)

        def step_a():
            pass

        def step_b():
            pass

        step("abc")(step_a)
        registry.steps.should.have.length_of(1)
        registry.steps["abc"].should.be.equal(step_a)

        step("def")(step_b)
        registry.steps.should.have.length_of(2)
        registry.steps["def"].should.be.equal(step_b)