idonethis: Remove extra newlines in code & tests.
Also rename list_steams -> list_teams.
MODIFY
zulip_bots/zulip_bots/bots/idonethis/idonethis.py
zulip_bots/zulip_bots/bots/idonethis/idonethis.py
@@ -64,8 +64,8 @@ def api_list_entries(team_id: Optional[str]=None) -> List[Dict[str, Any]]:
def api_create_entry(body: str, team_id: str) -> Dict[str, Any]:
return make_API_request("/entries", "POST", {"body": body, "team_id": team_id})
-def list_steams() -> str:
- response = ["Teams:"] + [" * " + team['name'] for team in api_list_team()] + [""]
+def list_teams() -> str:
+ response = ["Teams:"] + [" * " + team['name'] for team in api_list_team()]
return "\n".join(response)
def get_team_hash(team_name: str) -> str:
@@ -78,24 +78,25 @@ def team_info(team_name: str) -> str:
data = api_show_team(get_team_hash(team_name))
return "\n".join(["Team Name: {name}",
"ID: `{hash_id}`",
- "Created at: {created_at}", ""]).format(**data)
+ "Created at: {created_at}"]).format(**data)
def entries_list(team_name: str) -> str:
if team_name:
data = api_list_entries(get_team_hash(team_name))
- response = "Entries for {}:\n".format(team_name)
+ response = "Entries for {}:".format(team_name)
else:
data = api_list_entries()
- response = "Entries for all teams:\n"
+ response = "Entries for all teams:"
for entry in data:
response += "\n".join(
- [" * {body_formatted}",
+ ["",
+ " * {body_formatted}",
" * Created at: {created_at}",
" * Status: {status}",
" * User: {username}",
" * Team: {teamname}",
- " * ID: {hash_id}",
- ""]).format(username=entry['user']['full_name'],
+ " * ID: {hash_id}"
+ ]).format(username=entry['user']['full_name'],
teamname=entry['team']['name'],
**entry)
return response
@@ -188,7 +189,7 @@ Below are some of the commands you can use, and what they do.
try:
command = " ".join(message_content[:2])
if command in ["teams list", "list teams"]:
- reply = list_steams()
+ reply = list_teams()
elif command in ["teams info", "team info"]:
if len(message_content) > 2:
reply = team_info(" ".join(message_content[2:]))

MODIFY
zulip_bots/zulip_bots/bots/idonethis/test_idonethis.py
zulip_bots/zulip_bots/bots/idonethis/test_idonethis.py
@@ -41,7 +41,7 @@ class TestIDoneThisBot(BotTestCase):
with self.mock_config_info({'api_key': '12345678', 'default_team': 'testing team 1'}), \
self.mock_http_conversation('team_list'):
self.verify_reply('list teams',
- 'Teams:\n * testing team 1\n * test_team_2\n')
+ 'Teams:\n * testing team 1\n * test_team_2')
def test_show_team_no_team(self) -> None:
with self.mock_config_info({'api_key': '12345678', 'default_team': 'testing team 1'}), \
@@ -57,7 +57,7 @@ class TestIDoneThisBot(BotTestCase):
self.verify_reply('team info testing team 1',
'Team Name: testing team 1\n'
'ID: `31415926535`\n'
- 'Created at: 2017-12-28T19:12:55.121+11:00\n')
+ 'Created at: 2017-12-28T19:12:55.121+11:00')
get_team_hashFunction.assert_called_with('testing team 1')
def test_entries_list(self) -> None:
@@ -83,7 +83,7 @@ class TestIDoneThisBot(BotTestCase):
' * Status: done\n'
' * User: John Doe\n'
' * Team: testing team 1\n'
- ' * ID: 72c8241d2218464433268c5abd6625ac104e3d8f\n')
+ ' * ID: 72c8241d2218464433268c5abd6625ac104e3d8f')
def test_bot_responds_to_empty_message(self) -> None:
with self.mock_config_info({'api_key': '12345678', 'bot_info': 'team'}), \

idonethis: Remove extra newlines in code & tests.

Also rename list_steams -> list_teams.