Skip to content

Commit

Permalink
No logic in test code. (errbotio#975)
Browse files Browse the repository at this point in the history
  • Loading branch information
gbin authored Mar 12, 2017
1 parent 07b9ff4 commit de7b849
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions tests/base_backend_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,15 +459,13 @@ def test_regex_commands_allow_passing_re_flags(dummy_backend):


def test_arg_botcmd_returns_first_name_last_name(dummy_backend):
first_name = 'Err'
last_name = 'Bot'
dummy_backend.callback_message(
makemessage(
dummy_backend,
"!returns_first_name_last_name --first-name=%s --last-name=%s" % (first_name, last_name)
"!returns_first_name_last_name --first-name=Err --last-name=Bot"
)
)
assert "%s %s" % (first_name, last_name) == dummy_backend.pop_message().body
assert "Err Bot"


def test_arg_botcmd_returns_with_escaping(dummy_backend):
Expand Down Expand Up @@ -495,24 +493,20 @@ def test_arg_botcmd_returns_with_incorrect_escaping(dummy_backend):


def test_arg_botcmd_yields_first_name_last_name(dummy_backend):
first_name = 'Err'
last_name = 'Bot'
dummy_backend.callback_message(
makemessage(
dummy_backend,
"!yields_first_name_last_name --first-name=%s --last-name=%s" % (first_name, last_name)
"!yields_first_name_last_name --first-name=Err --last-name=Bot"
)
)
assert "%s %s" % (first_name, last_name) == dummy_backend.pop_message().body
assert "Err Bot" == dummy_backend.pop_message().body


def test_arg_botcmd_returns_value_repeated_count_times(dummy_backend):
value = "Foo"
count = 5
dummy_backend.callback_message(
makemessage(dummy_backend, "!returns_value_repeated_count_times %s --count %s" % (value, count))
makemessage(dummy_backend, "!returns_value_repeated_count_times Foo --count 5")
)
assert value * count == dummy_backend.pop_message().body
assert "FooFooFooFooFoo" == dummy_backend.pop_message().body


def test_arg_botcmd_doesnt_raise_systemerror(dummy_backend):
Expand All @@ -531,25 +525,20 @@ def test_arg_botcmd_returns_help_message_as_chat(dummy_backend):


def test_arg_botcmd_undoes_fancy_unicode_dash_conversion(dummy_backend):
first_name = 'Err'
last_name = 'Bot'
dummy_backend.callback_message(
makemessage(
dummy_backend,
"!returns_first_name_last_name —first-name=%s —last-name=%s" % (first_name, last_name)
"!returns_first_name_last_name —first-name=Err —last-name=Bot"
)
)
assert "%s %s" % (first_name, last_name) == dummy_backend.pop_message().body
assert "Err Bot" == dummy_backend.pop_message().body


def test_arg_botcmd_without_argument_unpacking(dummy_backend):
first_name = 'Err'
last_name = 'Bot'
dummy_backend.callback_message(
makemessage(dummy_backend, "!returns_first_name_last_name_without_unpacking --first-name=%s --last-name=%s"
% (first_name, last_name))
makemessage(dummy_backend, "!returns_first_name_last_name_without_unpacking --first-name=Err --last-name=Bot")
)
assert "%s %s" % (first_name, last_name) == dummy_backend.pop_message().body
assert "Err Bot" == dummy_backend.pop_message().body


def test_access_controls(dummy_backend):
Expand Down

0 comments on commit de7b849

Please sign in to comment.