11import 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
95class TestTeam (BaseCase ):
@@ -149,10 +145,10 @@ def test_add_member(self):
149145self .assertRaises (github3 .GitHubError ,self .org .add_member ,None ,None )
150146
151147self .login ()
152- with patch .object (github3 .orgs .Organization ,'iter_teams' )as it :
148+ with mock . patch .object (github3 .orgs .Organization ,'iter_teams' )as it :
153149it .return_value = iter ([])
154150assert self .org .add_member ('foo' ,'bar' )is False
155- team = Mock ()
151+ team = mock . Mock ()
156152team .name = 'bar'
157153team .add_member .return_value = True
158154it .return_value = iter ([team ])
@@ -163,10 +159,10 @@ def test_add_repo(self):
163159self .assertRaises (github3 .GitHubError ,self .org .add_repo ,None ,None )
164160
165161self .login ()
166- with patch .object (github3 .orgs .Organization ,'iter_teams' )as it :
162+ with mock . patch .object (github3 .orgs .Organization ,'iter_teams' )as it :
167163it .return_value = iter ([])
168164assert self .org .add_repo ('foo' ,'bar' )is False
169- team = Mock ()
165+ team = mock . Mock ()
170166team .name = 'bar'
171167team .add_repo .return_value = True
172168it .return_value = iter ([team ])
@@ -343,10 +339,10 @@ def test_remove_repo(self):
343339None ,None )
344340
345341self .login ()
346- with patch .object (github3 .orgs .Organization ,'iter_teams' )as it :
342+ with mock . patch .object (github3 .orgs .Organization ,'iter_teams' )as it :
347343it .return_value = iter ([])
348344assert self .org .remove_repo ('foo' ,'bar' )is False
349- team = Mock ()
345+ team = mock . Mock ()
350346team .name = 'bar'
351347team .remove_repo .return_value = True
352348it .return_value = iter ([team ])