From 1f08ffdc10f19de0f35bef6483d877956e56c5b6 Mon Sep 17 00:00:00 2001 From: Nitanshu Date: Fri, 22 Jun 2018 12:09:25 +0530 Subject: [PATCH] requirements.txt: Update Errbot Closes https://github.com/coala/corobo/issues/571 --- .moban.yaml | 2 +- requirements.txt | 2 +- tests/ban_test.py | 6 ++---- tests/git_stats_test.py | 3 +-- tests/helper.py | 2 +- tests/labhub_test.py | 23 ++++++++--------------- 6 files changed, 14 insertions(+), 24 deletions(-) diff --git a/.moban.yaml b/.moban.yaml index be3e046b..bdc4839e 100644 --- a/.moban.yaml +++ b/.moban.yaml @@ -4,7 +4,7 @@ name: corobo dependencies: - pyopenssl<17.5 - - git+https://github.com/errbotio/errbot@c2639879d4c298933cdf406193de5a5e626db12b + - git+https://github.com/errbotio/errbot@a0f35732484c8c0692e123c48653517cffa21a42 - wolframalpha - github3.py~=1.0.0 - IGitt==0.4.1.dev20180317153318 diff --git a/requirements.txt b/requirements.txt index fe8044ed..60566816 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ pyopenssl<17.5 -git+https://github.com/errbotio/errbot@c2639879d4c298933cdf406193de5a5e626db12b +git+https://github.com/errbotio/errbot@a0f35732484c8c0692e123c48653517cffa21a42 wolframalpha github3.py~=1.0.0 IGitt==0.4.1.dev20180317153318 diff --git a/tests/ban_test.py b/tests/ban_test.py index 678bde64..1e04f884 100644 --- a/tests/ban_test.py +++ b/tests/ban_test.py @@ -12,8 +12,7 @@ class TestBan(unittest.TestCase): @patch('plugins.ban.requests') @patch('plugins.ban.json') def test_ban_cmd(self, mockjson, mockreq): - ban, testbot = plugin_testbot(plugins.ban.Ban, logging.ERROR) - ban.activate() + ban, testbot = plugin_testbot('Ban', logging.ERROR) ban.bot_config.ROOMS_TO_JOIN = ('coala/coala', 'coala/coala-bears') ban.bot_config.BOT_IDENTITY['token'] = 'mocked?' @@ -34,8 +33,7 @@ def test_ban_cmd(self, mockjson, mockreq): @patch('plugins.ban.requests') @patch('plugins.ban.json') def test_unban_cmd(self, mockjson, mockreq): - ban, testbot = plugin_testbot(plugins.ban.Ban, logging.ERROR) - ban.activate() + ban, testbot = plugin_testbot('Ban', logging.ERROR) ban.bot_config.ROOMS_TO_JOIN = ('coala/coala', 'coala/coala-bears') ban.bot_config.BOT_IDENTITY['token'] = 'mocked?' diff --git a/tests/git_stats_test.py b/tests/git_stats_test.py index 100029c3..2fabe757 100644 --- a/tests/git_stats_test.py +++ b/tests/git_stats_test.py @@ -28,12 +28,11 @@ def setUp(self): self.mock_gh.organization.return_value = self.mock_org plugins.git_stats.github3.organization.return_value = self.mock_org - self.plugin = plugins.git_stats.GitStats + self.plugin = 'GitStats' self.plugin.__bases__ = (BotPlugin, ) def test_pr_list(self): git_stats, testbot = plugin_testbot(self.plugin, logging.ERROR) - git_stats.activate() git_stats.REPOS = {'test': self.mock_repo} mock_github_mr = create_autospec(GitHubMergeRequest) diff --git a/tests/helper.py b/tests/helper.py index 1ecb62d2..0e1ef722 100644 --- a/tests/helper.py +++ b/tests/helper.py @@ -4,5 +4,5 @@ def plugin_testbot(klass, loglevel, config=None): config = config if config else dict() testbot = TestBot(loglevel=loglevel, extra_config=config) testbot.start() - plug = testbot.bot.plugin_manager.instanciateElement(klass) + plug = testbot.bot.plugin_manager.get_plugin_obj_by_name(klass) return plug, testbot diff --git a/tests/labhub_test.py b/tests/labhub_test.py index d5732f24..252c1a17 100644 --- a/tests/labhub_test.py +++ b/tests/labhub_test.py @@ -47,8 +47,7 @@ def test_invite_cmd(self): 'coala developers': mock_team_developers } - labhub, testbot = plugin_testbot(plugins.labhub.LabHub, logging.ERROR) - labhub.activate() + labhub, testbot = plugin_testbot('LabHub', logging.ERROR) labhub._teams = teams plugins.labhub.os.environ['GH_TOKEN'] = 'patched?' @@ -133,10 +132,9 @@ def test_create_issue_cmd(self): plugins.labhub.GitLabPrivateToken = create_autospec(IGitt.GitLab.GitLabPrivateToken) labhub, testbot_private = plugin_testbot( - plugins.labhub.LabHub, logging.ERROR, + 'LabHub', logging.ERROR, {'BACKEND': 'text', 'ACCESS_CONTROLS':{'create_issue_cmd' : {'allowprivate':False}}} ) - labhub.activate() labhub.REPOS = {'repository': self.mock_repo} plugins.labhub.GitHubToken.assert_called_with(None) plugins.labhub.GitLabPrivateToken.assert_called_with(None) @@ -149,9 +147,8 @@ def test_create_issue_cmd(self): # Creating issue in public chat labhub, testbot_public = plugin_testbot( - plugins.labhub.LabHub, logging.ERROR, {'BACKEND': 'text'} + 'LabHub', logging.ERROR, {'BACKEND': 'text'} ) - labhub.activate() labhub.REPOS = {'repository': self.mock_repo, 'repository.github.io': self.mock_repo} @@ -182,9 +179,8 @@ def test_is_newcomer_issue(self): def test_unassign_cmd(self): plugins.labhub.GitHub = create_autospec(IGitt.GitHub.GitHub.GitHub) plugins.labhub.GitLab = create_autospec(IGitt.GitLab.GitLab.GitLab) - labhub, testbot = plugin_testbot(plugins.labhub.LabHub, logging.ERROR) + labhub, testbot = plugin_testbot('LabHub', logging.ERROR) - labhub.activate() labhub.REPOS = {'name': self.mock_repo} mock_iss = create_autospec(IGitt.GitHub.GitHubIssue) @@ -211,8 +207,7 @@ def test_unassign_cmd(self): def test_assign_cmd(self): plugins.labhub.GitHub = create_autospec(IGitt.GitHub.GitHub.GitHub) plugins.labhub.GitLab = create_autospec(IGitt.GitLab.GitLab.GitLab) - labhub, testbot = plugin_testbot(plugins.labhub.LabHub, logging.ERROR) - labhub.activate() + labhub, testbot = plugin_testbot('LabHub', logging.ERROR) mock_issue = create_autospec(GitHubIssue) self.mock_repo.get_issue.return_value = mock_issue @@ -235,7 +230,7 @@ def test_assign_cmd(self): testbot.assertCommand(cmd.format('coala', 'a', '23'), 'You\'ve been assigned to the issue') - + # no assignee, newcomer, initiatives/gci mock_maint_team.is_member.return_value = False mock_dev_team.is_member.return_value = False @@ -322,8 +317,7 @@ def test_assign_cmd(self): 'not eligible to be assigned to this issue') def test_mark_cmd(self): - labhub, testbot = plugin_testbot(plugins.labhub.LabHub, logging.ERROR) - labhub.activate() + labhub, testbot = plugin_testbot('LabHub', logging.ERROR) labhub.REPOS = {'a': self.mock_repo} mock_github_mr = create_autospec(GitHubMergeRequest) @@ -376,7 +370,7 @@ def test_mark_cmd(self): 'marked pending review') def test_alive(self): - labhub, testbot = plugin_testbot(plugins.labhub.LabHub, logging.ERROR) + labhub, testbot = plugin_testbot('LabHub', logging.ERROR) with patch('plugins.labhub.time.sleep') as mock_sleep: labhub.gh_repos = { 'coala': create_autospec(IGitt.GitHub.GitHub.GitHubRepository), @@ -390,7 +384,6 @@ def test_alive(self): labhub.gl_repos = { 'test': create_autospec(IGitt.GitLab.GitLab.GitLabRepository) } - labhub.activate() labhub.gh_repos['coala'].search_mrs.return_value = [1, 2] labhub.gh_repos['coala-bears'].search_mrs.return_value = []