-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #140 from botstory/hotfix/broken-tests
Hotfix/broken tests
- Loading branch information
Showing
12 changed files
with
215 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,45 @@ | ||
import pytest | ||
|
||
import botstory | ||
from botstory.utils import answer, build_fake_session, build_fake_user, SimpleTrigger | ||
from botstory.utils import answer, SimpleTrigger | ||
|
||
story = None | ||
|
||
|
||
def teardown_function(function): | ||
story.clear() | ||
|
||
|
||
@pytest.mark.skip | ||
@pytest.mark.asyncio | ||
@pytest.mark.skip | ||
async def test_jump_in_a_loop(): | ||
global story | ||
story = botstory.Story() | ||
|
||
user = build_fake_user() | ||
session = build_fake_session() | ||
|
||
trigger_show_global_help = SimpleTrigger() | ||
trigger_show_local_help = SimpleTrigger() | ||
|
||
@story.on('?') | ||
def global_help_story(): | ||
@story.part() | ||
def show_global_help(ctx): | ||
trigger_show_global_help.passed() | ||
|
||
@story.on('start job') | ||
def one_job(): | ||
@story.part() | ||
def show_do_job(ctx): | ||
pass | ||
|
||
@story.loop() | ||
def job_scope(): | ||
@story.on('?') | ||
def local_help_story(): | ||
@story.part() | ||
def show_local_help(): | ||
trigger_show_local_help.passed() | ||
|
||
@story.on('work') | ||
def job_story(): | ||
@story.part() | ||
def do_some_job(ctx): | ||
pass | ||
|
||
await answer.pure_text('start job', session, user, story) | ||
await answer.pure_text('?', session, user, story) | ||
with answer.Talk() as talk: | ||
story = talk.story | ||
|
||
@story.on('?') | ||
def global_help_story(): | ||
@story.part() | ||
def show_global_help(ctx): | ||
trigger_show_global_help.passed() | ||
|
||
@story.on('start job') | ||
def one_job(): | ||
@story.part() | ||
def show_do_job(ctx): | ||
pass | ||
|
||
@story.loop() | ||
def job_scope(): | ||
@story.on('?') | ||
def local_help_story(): | ||
@story.part() | ||
def show_local_help(): | ||
trigger_show_local_help.passed() | ||
|
||
@story.on('work') | ||
def job_story(): | ||
@story.part() | ||
def do_some_job(ctx): | ||
pass | ||
|
||
await talk.pure_text('start job') | ||
await talk.pure_text('?') | ||
|
||
assert trigger_show_global_help.is_triggered is not True | ||
assert trigger_show_local_help.is_triggered is True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.