本文整理汇总了Python中pyccuracy.fixture.Fixture.append_story方法的典型用法代码示例。如果您正苦于以下问题:Python Fixture.append_story方法的具体用法?Python Fixture.append_story怎么用?Python Fixture.append_story使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyccuracy.fixture.Fixture
的用法示例。
在下文中一共展示了Fixture.append_story方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_story_runner_returns_a_result_with_the_original_Fixture
# 需要导入模块: from pyccuracy.fixture import Fixture [as 别名]
# 或者: from pyccuracy.fixture.Fixture import append_story [as 别名]
def test_story_runner_returns_a_result_with_the_original_Fixture():
mocker = Mocker()
settings = Settings()
fixture = Fixture()
action = some_action()
fixture.append_story(action.scenario.story)
runner = StoryRunner()
context = Object()
context.browser_driver = mocker.mock()
context.browser_driver.start_test("http://localhost")
context.browser_driver.stop_test()
context.settings = mocker.mock()
context.settings.on_before_action
mocker.result(None)
context.settings.on_action_successful
mocker.result(None)
context.language = mocker.mock()
context.language.get('given')
mocker.result('Given')
context.language.get('when')
mocker.result('When')
context.language.get('then')
mocker.result('Then')
with mocker:
result = runner.run_stories(settings, fixture, context=context)
assert result.fixture == fixture
示例2: test_see_summary_for_fixture_returns_proper_string_for_failed_tests
# 需要导入模块: from pyccuracy.fixture import Fixture [as 别名]
# 或者: from pyccuracy.fixture.Fixture import append_story [as 别名]
def test_see_summary_for_fixture_returns_proper_string_for_failed_tests():
mocker = Mocker()
expected = """================
Test Run Summary
================
Status: FAILED
Test Data Stats
---------------
Successful Stories......0/1 (0.00%)
Failed Stories..........1/1 (100.00%)
Successful Scenarios....0/1 (0.00%)
Failed Scenarios........1/1 (100.00%)"""
template_loader_mock = mocker.mock()
template_loader_mock.load("summary")
mocker.result(summary_template)
with mocker:
settings = Settings()
fixture = Fixture()
action = some_action()
fixture.append_story(action.scenario.story)
action.mark_as_failed()
result = Result(fixture=fixture, template_loader=template_loader_mock)
summary = result.summary_for(settings.default_culture)
assert summary == expected
示例3: test_should_catch_assertion_error
# 需要导入模块: from pyccuracy.fixture import Fixture [as 别名]
# 或者: from pyccuracy.fixture.Fixture import append_story [as 别名]
def test_should_catch_assertion_error():
mocker = Mocker()
def action_failed_method(context, *args, **kwargs):
assert False, "bla"
settings = Settings()
runner = StoryRunner()
fixture = Fixture()
action = some_action()
fixture.append_story(action.scenario.story)
action.execute_function = action_failed_method
context = Object()
context.browser_driver = mocker.mock()
context.browser_driver.start_test("http://localhost")
context.browser_driver.stop_test()
context.settings = mocker.mock()
context.settings.on_before_action
mocker.result(None)
context.settings.on_action_error
mocker.result(None)
context.language = mocker.mock()
context.language.get('given')
mocker.result('Given')
with mocker:
result = runner.run_stories(settings=settings, fixture=fixture, context=context)
assert isinstance(action.error, AssertionError)
assert action.error.message == "bla"
示例4: test_should_execute_scenarios_successfully
# 需要导入模块: from pyccuracy.fixture import Fixture [as 别名]
# 或者: from pyccuracy.fixture.Fixture import append_story [as 别名]
def test_should_execute_scenarios_successfully():
settings = Settings()
runner = StoryRunner()
fixture = Fixture()
fixture.append_story(some_action().scenario.story)
context = Mock()
context.browser_driver = Mock()
context.browser_driver.expects(once()).start_test(eq("http://localhost"))
context.browser_driver.expects(once()).stop_test()
context.settings = Mock()
context.settings.on_before_action = None
context.settings.on_action_successful = None
context.settings.on_action_error = None
context.language = Mock()
context.language \
.expects(once()) \
.get(eq('given')) \
.will(return_value('Given'))
context.language \
.expects(once()) \
.get(eq('when')) \
.will(return_value('When'))
context.language \
.expects(once()) \
.get(eq('then')) \
.will(return_value('Then'))
result = runner.run_stories(settings=settings, fixture=fixture, context=context)
assert fixture.get_status() == Status.Successful
context.verify()
context.browser_driver.verify()
示例5: test_append_story_keeps_data
# 需要导入模块: from pyccuracy.fixture import Fixture [as 别名]
# 或者: from pyccuracy.fixture.Fixture import append_story [as 别名]
def test_append_story_keeps_data():
fixture = Fixture()
story = Story("some", "other", "data", identity="Some File")
fixture.append_story(story)
assert fixture.stories[0].as_a == "some"
assert fixture.stories[0].i_want_to == "other"
assert fixture.stories[0].so_that == "data"
示例6: test_story_runner_returns_a_result_with_the_original_Fixture
# 需要导入模块: from pyccuracy.fixture import Fixture [as 别名]
# 或者: from pyccuracy.fixture.Fixture import append_story [as 别名]
def test_story_runner_returns_a_result_with_the_original_Fixture():
settings = Settings()
fixture = Fixture()
action = some_action()
fixture.append_story(action.scenario.story)
runner = StoryRunner()
context = Mock()
context.browser_driver = Mock()
context.browser_driver.expects(once()).start_test(eq("http://localhost"))
context.browser_driver.expects(once()).stop_test()
context.settings = Mock()
context.settings.on_before_action = None
context.settings.on_action_successful = None
context.settings.on_action_error = None
context.language = Mock()
context.language \
.expects(once()) \
.get(eq('given')) \
.will(return_value('Given'))
context.language \
.expects(once()) \
.get(eq('when')) \
.will(return_value('When'))
context.language \
.expects(once()) \
.get(eq('then')) \
.will(return_value('Then'))
result = runner.run_stories(settings, fixture, context=context)
assert result.fixture == fixture
context.verify()
context.browser_driver.verify()
示例7: test_should_execute_scenarios_successfully
# 需要导入模块: from pyccuracy.fixture import Fixture [as 别名]
# 或者: from pyccuracy.fixture.Fixture import append_story [as 别名]
def test_should_execute_scenarios_successfully():
mocker = Mocker()
settings = Settings()
runner = StoryRunner()
fixture = Fixture()
fixture.append_story(some_action().scenario.story)
context = Object()
context.browser_driver = mocker.mock()
context.browser_driver.start_test("http://localhost")
context.browser_driver.stop_test()
context.settings = mocker.mock()
context.settings.on_before_action
mocker.result(None)
context.settings.on_action_successful
mocker.result(None)
context.language = mocker.mock()
context.language.get('given')
mocker.result('Given')
context.language.get('when')
mocker.result('When')
context.language.get('then')
mocker.result('Then')
with mocker:
result = runner.run_stories(settings=settings, fixture=fixture, context=context)
assert fixture.get_status() == Status.Successful
示例8: test_fixture_returns_proper_status_if_action_succeeded
# 需要导入模块: from pyccuracy.fixture import Fixture [as 别名]
# 或者: from pyccuracy.fixture.Fixture import append_story [as 别名]
def test_fixture_returns_proper_status_if_action_succeeded():
fixture = Fixture()
action = some_action()
fixture.append_story(action.scenario.story)
action.mark_as_successful()
assert fixture.get_status() == Status.Successful
示例9: test_see_summary_for_fixture_returns_proper_string
# 需要导入模块: from pyccuracy.fixture import Fixture [as 别名]
# 或者: from pyccuracy.fixture.Fixture import append_story [as 别名]
def test_see_summary_for_fixture_returns_proper_string():
expected = """================
Test Run Summary
================
Status: SUCCESSFUL
Test Data Stats
---------------
Successful Stories......1/1 (100.00%)
Failed Stories..........0/1 (0.00%)
Successful Scenarios....1/1 (100.00%)
Failed Scenarios........0/1 (0.00%)"""
template_loader_mock = Mock()
template_loader_mock.expects(once()) \
.load(eq("summary")) \
.will(return_value(summary_template))
settings = Settings()
fixture = Fixture()
action = some_action()
fixture.append_story(action.scenario.story)
action.mark_as_successful()
result = Result(fixture=fixture, template_loader=template_loader_mock)
summary = result.summary_for(settings.default_culture)
assert summary == expected
示例10: test_should_handle_action_errors_successfully
# 需要导入模块: from pyccuracy.fixture import Fixture [as 别名]
# 或者: from pyccuracy.fixture.Fixture import append_story [as 别名]
def test_should_handle_action_errors_successfully():
mocker = Mocker()
def action_failed_method(context, *args, **kwargs):
raise ActionFailedError("bla")
settings = Settings()
runner = StoryRunner()
fixture = Fixture()
action = some_action()
fixture.append_story(action.scenario.story)
action.execute_function = action_failed_method
context = Object()
context.browser_driver = mocker.mock()
context.browser_driver.start_test("http://localhost")
context.browser_driver.stop_test()
context.settings = mocker.mock()
context.settings.on_before_action
mocker.result(None)
context.settings.on_action_error
mocker.result(None)
context.language = mocker.mock()
context.language.get('given')
mocker.result('Given')
with mocker:
result = runner.run_stories(settings=settings, fixture=fixture, context=context)
assert fixture.get_status() == Status.Failed
示例11: test_fixture_returns_proper_status_with_two_scenarios_with_both_successful
# 需要导入模块: from pyccuracy.fixture import Fixture [as 别名]
# 或者: from pyccuracy.fixture.Fixture import append_story [as 别名]
def test_fixture_returns_proper_status_with_two_scenarios_with_both_successful():
fixture = Fixture()
action = some_action()
other_action = some_action()
fixture.append_story(action.scenario.story)
fixture.append_story(other_action.scenario.story)
action.mark_as_successful()
other_action.mark_as_successful()
assert fixture.get_status() == Status.Successful
示例12: test_fixture_returns_total_successful_scenarios
# 需要导入模块: from pyccuracy.fixture import Fixture [as 别名]
# 或者: from pyccuracy.fixture.Fixture import append_story [as 别名]
def test_fixture_returns_total_successful_scenarios():
fixture = Fixture()
action = some_action()
other_action = some_action()
fixture.append_story(action.scenario.story)
fixture.append_story(other_action.scenario.story)
action.mark_as_successful()
other_action.mark_as_successful()
assert fixture.count_successful_scenarios() == 2
示例13: test_fixture_returns_failed_scenarios
# 需要导入模块: from pyccuracy.fixture import Fixture [as 别名]
# 或者: from pyccuracy.fixture.Fixture import append_story [as 别名]
def test_fixture_returns_failed_scenarios():
fixture = Fixture()
action = some_action()
other_action = some_action()
fixture.append_story(action.scenario.story)
fixture.append_story(other_action.scenario.story)
action.mark_as_failed()
other_action.mark_as_failed()
assert len(fixture.get_failed_scenarios()) == 2
示例14: test_see_summary_for_fixture
# 需要导入模块: from pyccuracy.fixture import Fixture [as 别名]
# 或者: from pyccuracy.fixture.Fixture import append_story [as 别名]
def test_see_summary_for_fixture():
template_loader_mock = Mock()
template_loader_mock.expects(once()) \
.load(eq("summary")) \
.will(return_value(summary_template))
settings = Settings()
fixture = Fixture()
action = some_action()
fixture.append_story(action.scenario.story)
action.mark_as_successful()
result = Result(fixture=fixture, template_loader=template_loader_mock)
summary = result.summary_for(settings.default_culture)
assert summary is not None
示例15: test_should_execute_scenarios_successfully
# 需要导入模块: from pyccuracy.fixture import Fixture [as 别名]
# 或者: from pyccuracy.fixture.Fixture import append_story [as 别名]
def test_should_execute_scenarios_successfully():
settings = Settings()
runner = StoryRunner()
fixture = Fixture()
fixture.append_story(some_action().scenario.story)
context = Mock()
context.browser_driver = Mock()
context.browser_driver.expects(once()).start_test(eq("http://localhost"))
context.browser_driver.expects(once()).stop_test()
result = runner.run_stories(settings=settings, fixture=fixture, context=context)
assert fixture.get_status() == Status.Successful
context.verify()
context.browser_driver.verify()