8000 Update references to mock in Organization tests · davidmoss/github3.py@1886cf3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1886cf3

Browse files
committed
Update references to mock in Organization tests
1 parent d381ed8 commit 1886cf3

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

tests/test_orgs.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import github3
2-
try:
3-
from unittest.mock import patch, Mock
4-
except ImportError:
5-
from mock import patch, Mock
6-
from tests.utils import BaseCase, load
2+
from tests.utils import BaseCase, load, mock
73

84

95
class TestTeam(BaseCase):
@@ -149,10 +145,10 @@ def test_add_member(self):
149145
self.assertRaises(github3.GitHubError, self.org.add_member, None, None)
150146

151147
self.login()
152-
with patch.object(github3.orgs.Organization, 'iter_teams') as it:
148+
with mock.patch.object(github3.orgs.Organization, 'iter_teams') as it:
153149
it.return_value = iter([])
154150
assert self.org.add_member('foo', 'bar') is False
155-
team = Mock()
151+
team = mock.Mock()
156152
team.name = 'bar'
157153
team.add_member.return_value = True
158154
it.return_value = iter([team])
@@ -163,10 +159,10 @@ def test_add_repo(self):
163159
self.assertRaises(github3.GitHubError, self.org.add_repo, None, None)
164160

165161
self.login()
166-
with patch.object(github3.orgs.Organization, 'iter_teams') as it:
162+
with mock.patch.object(github3.orgs.Organization, 'iter_teams') as it:
167163
it.return_value = iter([])
168164
assert self.org.add_repo('foo', 'bar') is False
169-
team = Mock()
165+
team = mock.Mock()
170166
team.name = 'bar'
171167
team.add_repo.return_value = True
172168
it.return_value = iter([team])
@@ -343,10 +339,10 @@ def test_remove_repo(self):
343339
None, None)
344340

345341
self.login()
346-
with patch.object(github3.orgs.Organization, 'iter_teams') as it:
342+
with mock.patch.object(github3.orgs.Organization, 'iter_teams') as it:
347343
it.return_value = iter([])
348344
assert self.org.remove_repo('foo', 'bar') is False
349-
team = Mock()
345+
team = mock.Mock()
350346
team.name = 'bar'
351347
team.remove_repo.return_value = True
352348
it.return_value = iter([team])

0 commit comments

Comments
 (0)
0