Skip to content

Commit ad0a199

Browse files
committed
Begin testing that authentication is required
1 parent 60dac24 commit ad0a199

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

tests/unit/test_auths.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Unit tests for the auths module."""
22
import github3
3+
import pytest
34

45
from .helper import UnitHelper, create_url_helper
56

@@ -52,3 +53,21 @@ def test_replace_scopes(self):
5253
self.post_called_with(url_for(''), data={
5354
'scopes': ['scope-one', 'scope-two', 'scope-three'],
5455
})
56+
57+
58+
class TestAuthorizationRequiresAuth(UnitHelper):
59+
60+
"""Test methods that require authentication on Authorization."""
61+
62+
described_class = github3.auths.Authorization
63+
example_data = TestAuthorization.example_data.copy()
64+
65+
def after_setup(self):
66+
"""Disable authentication on the Session."""
67+
self.session.has_auth.return_value = False
68+
self.session.auth = None
69+
70+
def test_add_scopes(self):
71+
"""Test that add scopes requires authentication."""
72+
with pytest.raises(github3.AuthenticationFailed):
73+
self.instance.add_scopes()

0 commit comments

Comments
 (0)