def test_stepregistry_should_allow_to_register_step_impls(): """The StepRegistry should allow to register a Step Implementation""" # given registry = StepRegistry() # when registry.register("Given", "pattern", None) # then assert registry.step_implementations("Given") == [ StepImpl("Given", "pattern", None) ]
def test_stepregistry_should_gracefully_accept_double_registration(): """ The StepRegistry should gracefully accept a duplicate registration of a Step Implementation """ # given registry = StepRegistry() registry.register("Given", "pattern", None) # when registry.register("Given", "pattern", None) # then assert registry.step_implementations("Given") == [ StepImpl("Given", "pattern", None) ]
def test_registering_steps(self): """ Test registering multiple steps """ registry = StepRegistry() registry.steps.should.be.empty def step_a(): pass def step_b(): pass registry.register("abc", step_a) registry.steps.should.have.length_of(1) registry.steps["abc"].should.be.equal(step_a) registry.register("def", step_b) registry.steps.should.have.length_of(2) registry.steps["def"].should.be.equal(step_b)
def test_registering_steps(self): """ Test registering multiple steps """ registry = StepRegistry() registry.steps.should.be.empty def step_a(): pass def step_b(): pass registry.register("abc", step_a) registry.steps.should.have.length_of(1) registry.steps["abc"].should.be.equal(step_a) registry.register("def", step_b) registry.steps.should.have.length_of(2) registry.steps["def"].should.be.equal(step_b)
def test_registering_same_step(self): """ Test registering step with same regex """ registry = StepRegistry() registry.steps.should.be.empty def step_a(): pass def step_b(): pass registry.register("abc", step_a) registry.steps.should.have.length_of(1) registry.steps["abc"].should.be.equal(step_a) registry.register.when.called_with("abc", step_b).should.throw(SameStepError, "Cannot register step step_b with regex 'abc' because it is already used by step step_a") registry.steps.should.have.length_of(1) registry.steps["abc"].should.be.equal(step_a)
def test_registering_same_step(self): """ Test registering step with same regex """ registry = StepRegistry() registry.steps.should.be.empty def step_a(): pass def step_b(): pass registry.register("abc", step_a) registry.steps.should.have.length_of(1) registry.steps["abc"].should.be.equal(step_a) registry.register.when.called_with("abc", step_b).should.throw( SameStepError, "Cannot register step step_b with regex 'abc' because it is already used by step step_a" ) registry.steps.should.have.length_of(1) registry.steps["abc"].should.be.equal(step_a)