def test_stepregistry_should_create_one_step_decorator_per_keyword(): """The StepRegistry should create one Step decorator for each keyword""" # given registry = StepRegistry() context = {} # when registry.create_step_decorators(context) # then assert len(context) == 4 assert "given" in context assert "when" in context assert "then" in context assert "step" in context
def test_stepregistry_step_decorator_should_register_func_with_proper_keyword(keyword): """The StepRegistry should create one Step decorator for each keyword""" # given registry = StepRegistry() context = {} registry.create_step_decorators(context) # when def test_step(): ... test_step = context[keyword.lower()]("pattern")(test_step) # then assert registry.step_implementations(keyword) == [ StepImpl(keyword, "pattern", test_step) ]
def test_stepregitry_step_decorators_for_all_keywords(): """The StepRegistry should return the Step Implementations registered with the ``step`` decorator for all keywords. """ # given registry = StepRegistry() context = {} registry.create_step_decorators(context) # when def test_step(): ... test_step = context["step"]("pattern")(test_step) # then assert registry.step_implementations("Given") == [ StepImpl("Step", "pattern", test_step) ]
def test_stepregitry_register_func_with_multiple_decorators(): """The StepRegistry should allow a function to be registered with multiple Step decorators""" # given registry = StepRegistry() context = {} registry.create_step_decorators(context) # when def test_step(): ... test_step = context["given"]("pattern")(test_step) test_step = context["when"]("pattern")(test_step) # then assert registry.step_implementations("Given") == [ StepImpl("Given", "pattern", test_step) ] assert registry.step_implementations("When") == [ StepImpl("When", "pattern", test_step) ]