-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Attempt to automatically upload code coverage to Code Cov IO * Dictating which shell to us so we can run new command to upload coverage to code cov * Testing Peek returning the first element and the iterator * Testing None is returned if StopIteration is raised when calling next in peek * attempted to test init to prove debugging worked, skipping for now as dependency injection is failing. * Testing helper_get_public_channel_ids returns channel ids when received * Testing helper_get_public_channel_ids returns empty list channel ids when received none * Testing helper_get_private_channel_ids both with data and when none is found * Wrote tests for helper_get_user_names to ensure works when returning list of data or empty list when none is found * Tested helper_get_users_in_channel but also modified old tests to help pass again with the new channels_list modification needed for this test * no users now in this test for coverage * testing helper_user_name_to_user_id both with a response mapping username to userid and failure to do so * tested helper_user_name_to_user_id both when data is returned and when no match is found * added badge for mater branch to readme * Wrote tests for helper_user_id_to_user_name which should be the majority of the simple_slack_bot_class * Wrote first test for SlackRequest to prove initializer stores its arguments * Wrote tests for type property both when data is found and when it isn't * Factored out common property code in SlackRequest * refactored tests to match refactoring of the get method that all the properties use * Finished all property tests for SlackReqest * Moved common mock into its own package for multiple test files to use * testing SlackRequest write when exception is thrown * test SlackRequest str * generating coverage for all files now instead of just simple_slack_bot, added vebose and colors * Circle ci failed to upload coverage to code cov. Removing verbose and colors to see if this helps * Added tests for helper_channel_name_to_channel_id
- Loading branch information
1 parent
895f786
commit a642f6b
Showing
11 changed files
with
730 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
[run] | ||
include = | ||
# The only file we're interested in generating code coverage for | ||
simple_slack_bot/simple_slack_bot.py | ||
simple_slack_bot/* | ||
|
||
[report] | ||
fail_under = 90 | ||
show_missing = 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
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[pytest] | ||
testpaths = tests | ||
python_files = *.py | ||
python_functions = test_* |
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
Empty file.
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
class MockPythonSlackclient: | ||
def __init__( | ||
self, | ||
injectable_bool=None, | ||
injectable_public_channels=[], | ||
injectable_private_channels=[], | ||
injectable_user_ids=[], | ||
injectable_user_names=[], | ||
injectable_channel_names=[], | ||
injectable_chat_postMessage_exception=None, | ||
): | ||
self.injectable_bool = injectable_bool | ||
self.injectable_channel_names = injectable_channel_names | ||
self.injectable_public_channels = injectable_public_channels | ||
self.injectable_private_channels = injectable_private_channels | ||
self.injectable_user_ids = injectable_user_ids | ||
self.injectable_user_names = injectable_user_names | ||
self.injectable_chat_postMessage_exception = injectable_chat_postMessage_exception | ||
|
||
def rtm_start(self): | ||
return self.injectable_bool | ||
|
||
def channels_list(self): | ||
return { | ||
"channels": [ | ||
{"id": channel_id, "name": channel_name, "members": self.injectable_user_names} | ||
for channel_id, channel_name, member in zip( | ||
self.injectable_public_channels, | ||
self.injectable_channel_names, | ||
self.injectable_user_names, | ||
) | ||
] | ||
} | ||
|
||
def groups_list(self): | ||
return {"groups": [{"id": value} for value in self.injectable_private_channels]} | ||
|
||
def users_list(self): | ||
return { | ||
"members": [ | ||
{"id": id, "name": name} | ||
for id, name in zip(self.injectable_user_ids, self.injectable_user_names) | ||
] | ||
} | ||
|
||
def chat_postMessage(self, channel, text): | ||
self.was_chat_postMessage_called = True | ||
self.channel = channel | ||
self.text = text | ||
|
||
if self.injectable_chat_postMessage_exception: | ||
raise self.injectable_chat_postMessage_exception |
Oops, something went wrong.