- Notifications
You must be signed in to change notification settings - Fork673
add per_page config option#505
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -45,6 +45,7 @@ | ||
url = https://three.url | ||
private_token = MNOPQR | ||
ssl_verify = /path/to/CA/bundle.crt | ||
per_page = 50 | ||
[four] | ||
url = https://four.url | ||
@@ -66,6 +67,11 @@ | ||
[three] | ||
meh = hem | ||
[four] | ||
url = http://four.url | ||
private_token = ABCDEF | ||
per_page = 200 | ||
""" | ||
@@ -87,13 +93,19 @@ def test_invalid_id(self, m_open): | ||
@mock.patch('six.moves.builtins.open') | ||
def test_invalid_data(self, m_open): | ||
fd = six.StringIO(missing_attr_config) | ||
fd.close = mock.Mock(return_value=None, | ||
side_effect=lambda: fd.seek(0)) | ||
m_open.return_value = fd | ||
config.GitlabConfigParser('one') | ||
config.GitlabConfigParser('one') | ||
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. I don't think this duplicated line is useful :) Could you remove it? 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. I added this to test the change line#97. Without the fd.seek(0), all calls to config.GitlabConfigParser fail except the 1st one: # fd.tell() = 0config.GitlabConfigParser('one')# reads fd# fd.tell() = end of fileconfig.GitlabConfigParser('one')# reads nothing because fd is at end of file, so it fail 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. OK, thanks for the explanation. | ||
self.assertRaises(config.GitlabDataError, config.GitlabConfigParser, | ||
gitlab_id='two') | ||
self.assertRaises(config.GitlabDataError, config.GitlabConfigParser, | ||
gitlab_id='three') | ||
with self.assertRaises(config.GitlabDataError) as emgr: | ||
config.GitlabConfigParser('four') | ||
self.assertEqual('Unsupported per_page number: 200', | ||
emgr.exception.args[0]) | ||
@mock.patch('six.moves.builtins.open') | ||
def test_valid_data(self, m_open): | ||
@@ -108,6 +120,7 @@ def test_valid_data(self, m_open): | ||
self.assertEqual(None, cp.oauth_token) | ||
self.assertEqual(2, cp.timeout) | ||
self.assertEqual(True, cp.ssl_verify) | ||
self.assertIsNone(cp.per_page) | ||
fd = six.StringIO(valid_config) | ||
fd.close = mock.Mock(return_value=None) | ||
@@ -130,6 +143,7 @@ def test_valid_data(self, m_open): | ||
self.assertEqual(None, cp.oauth_token) | ||
self.assertEqual(2, cp.timeout) | ||
self.assertEqual("/path/to/CA/bundle.crt", cp.ssl_verify) | ||
self.assertEqual(50, cp.per_page) | ||
fd = six.StringIO(valid_config) | ||
fd.close = mock.Mock(return_value=None) | ||