forked from sigmavirus24/github3.py
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_auths.py
More file actions
45 lines (37 loc) · 1.83 KB
/
Copy pathtest_auths.py
File metadata and controls
45 lines (37 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"""Integration tests for the github3.auths module."""
import github3
from .helper import IntegrationHelper
class TestAuthorization(IntegrationHelper):
"""Integration tests for the Authorization class."""
def test_add_scopes(self):
"""Test the ability to add scopes to an authorization."""
self.basic_login()
cassette_name = self.cassette_name('add_scopes')
with self.recorder.use_cassette(cassette_name):
auth = self.gh.authorization(10716101)
assert isinstance(auth, github3.auths.Authorization)
assert auth.add_scopes(['user']) is True
def test_delete(self):
"""Test the ability to delete an authorization."""
self.basic_login()
cassette_name = self.cassette_name('delete')
with self.recorder.use_cassette(cassette_name):
auth = self.gh.authorization(10716101)
assert isinstance(auth, github3.auths.Authorization)
assert auth.delete() is True
def test_remove_scopes(self):
"""Test the ability to remove scopes from an authorization."""
self.basic_login()
cassette_name = self.cassette_name('remove_scopes')
with self.recorder.use_cassette(cassette_name):
auth = self.gh.authorization(10716101)
assert isinstance(auth, github3.auths.Authorization)
assert auth.remove_scopes(['user', 'public_repo']) is True
def test_replace_scopes(self):
"""Test the ability to replace scopes on an authorization."""
self.basic_login()
cassette_name = self.cassette_name('replace_scopes')
with self.recorder.use_cassette(cassette_name):
auth = self.gh.authorization(10716101)
assert isinstance(auth, github3.auths.Authorization)
assert auth.replace_scopes(['user', 'public_repo']) is True