-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LabHub: Use activate and configuration templates #577
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
import os | ||
|
||
API_DOCS = 'http://api.coala.io/en/latest' | ||
USER_DOCS = 'http://docs.coala.io/en/latest' | ||
|
||
GH_ORG_NAME = os.environ.get('GH_ORG_NAME', 'coala') | ||
GL_ORG_NAME = os.environ.get('GL_ORG_NAME', 'coala') | ||
|
||
MAX_MSG_LEN = 1000 | ||
MAX_LINES = 20 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,13 @@ def setUp(self): | |
}, | ||
'_teams': self.teams, | ||
} | ||
self.labhub = self.load_plugin('LabHub', self.global_mocks) | ||
configs = { | ||
'GH_TOKEN': None, | ||
'GL_TOKEN': None, | ||
'GH_ORG_NAME': 'coala', | ||
'GL_ORG_NAME': 'coala', | ||
} | ||
self.labhub = self.load_plugin('LabHub', self.global_mocks, configs) | ||
|
||
def test_invite_cmd(self): | ||
mock_team_newcomers = create_autospec(github3.orgs.Team) | ||
|
@@ -45,8 +51,6 @@ def test_invite_cmd(self): | |
self.inject_mocks('LabHub', mock_dict) | ||
testbot = self | ||
|
||
plugins.labhub.os.environ['GH_TOKEN'] = 'patched?' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note #572 (comment) You probably need a separate test method for this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current minor coverage error might be related to this |
||
|
||
self.assertEqual(self.labhub.TEAMS, self.teams) | ||
|
||
mock_dict['is_room_member'].return_value = False | ||
|
@@ -304,18 +308,18 @@ def test_assign_cmd(self): | |
|
||
# no assignee, newcomer, difficulty medium | ||
mock_dict = { | ||
'GH_ORG_NAME': 'not-coala', | ||
'TEAMS': { | ||
'not-coala newcomers': self.mock_team, | ||
'not-coala developers': mock_dev_team, | ||
'not-coala maintainers': mock_maint_team, | ||
}, | ||
} | ||
self.inject_mocks('LabHub', mock_dict) | ||
self.labhub.config['GH_ORG_NAME'] = 'not-coala' | ||
|
||
testbot.assertCommand(cmd.format('coala', 'a', '23'), | ||
'assigned') | ||
mock_dict['GH_ORG_NAME'] = 'coala' | ||
self.labhub.config['GH_ORG_NAME'] = 'coala' | ||
mock_dict['TEAMS'] = self.teams | ||
self.inject_mocks('LabHub', mock_dict) | ||
|
||
|
@@ -472,3 +476,12 @@ def test_alive(self): | |
'!pr stats 3hours', | ||
'You need to be a member of this organization ' | ||
'to use this command.', timeout=100) | ||
|
||
def test_invalid_token(self): | ||
plugins.labhub.github3.login.return_value = None | ||
with self.assertLogs() as cm: | ||
self.labhub.activate() | ||
self.assertIn( | ||
'ERROR:errbot.plugins.LabHub:Cannot create github object,' | ||
' please check GH_TOKEN', | ||
cm.output) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should be able to use requests-mock to break IGitt so it gives a RuntimeError , but ... not critical ... this is OK for now