diff --git a/tests/test_issue_authorize_optional_scope.py b/tests/test_issue_authorize_optional_scope.py deleted file mode 100644 index 51fd7fabf..000000000 --- a/tests/test_issue_authorize_optional_scope.py +++ /dev/null @@ -1,45 +0,0 @@ -import github3 -from tests.utils import BaseCase - -""" -http://github3py.readthedocs.org/en/0.7.0/github.html#github3.github.GitHub -says scopes are required to create an authorization. - -http://developer.github.com/v3/oauth/#create-a-new-authorization (at time of -writing - 2013-09-06) disagrees -""" - - -class TestOptionalScope(BaseCase): - def test_authorize_with_scope(self): - """ Copypasted from TestGitHub """ - - self.response('authorization', 201) - scopes = ['scope1', 'scope2'] - - self.g.authorize(None, None, scopes) - self.not_called() - - a = self.g.authorize('user', 'password', scopes) - assert isinstance(a, github3.auths.Authorization) - assert self.request.called is True - - self.request.reset_mock() - - self.login() - a = self.g.authorize(None, None, scopes=scopes) - - def test_authorize_without_scope(self): - self.response('authorization', 201) - - self.g.authorize(None, None) - self.not_called() - - a = self.g.authorize('user', 'password') - assert isinstance(a, github3.auths.Authorization) - assert self.request.called is True - - self.request.reset_mock() - - self.login() - a = self.g.authorize(None, None) diff --git a/tests/unit/test_github.py b/tests/unit/test_github.py index 0c6bb7674..ff242f316 100644 --- a/tests/unit/test_github.py +++ b/tests/unit/test_github.py @@ -23,6 +23,18 @@ def test_authorization(self): url_for('authorizations/10'), ) + def test_authorize_without_scope(self): + """Show an authorization can be created for a user without scope.""" + self.instance.authorize('username', 'password') + self.session.temporary_basic_auth.assert_called_once_with( + 'username', 'password' + ) + self.post_called_with( + url_for('authorizations'), + data={'note': '', 'note_url': '', 'client_id': '', + 'client_secret': ''} + ) + def test_authorize(self): """Show an authorization can be created for a user.""" self.instance.authorize('username', 'password', ['user', 'repo'])