Fix arguments and add tests to autospec
Remove incorrect reference to 'self' after conversion to function from object with method. Add some simple tests using autospecing to catch passing the wrong number of arguments to the underlying github login methods. Change-Id: I8919997fca40a170fe47811a66db7964ba58a9d3
This commit is contained in:
parent
701e2a1c36
commit
2f95f62904
|
@ -26,7 +26,7 @@ except ImportError:
|
|||
TEST_REPO_DESC = "########## Auto-generated test repository ##########"
|
||||
|
||||
|
||||
def _login(self, token, url=None):
|
||||
def _login(token, url=None):
|
||||
|
||||
if url is None:
|
||||
url = "https://github.com"
|
||||
|
|
|
@ -20,6 +20,20 @@ import testtools
|
|||
from fixtures_git import github as gh_fixture
|
||||
|
||||
|
||||
class TestGithubLogin(testtools.TestCase):
|
||||
|
||||
@mock.patch('fixtures_git.github.github.enterprise_login',
|
||||
autospec=True)
|
||||
def test_enterprise_login(self, mock_github_login):
|
||||
"""Test that correct list of arguments passed"""
|
||||
gh_fixture._login('my_api_token', url="https://github.company.com")
|
||||
|
||||
@mock.patch('fixtures_git.github.github.login', autospec=True)
|
||||
def test_default_login(self, mock_github_login):
|
||||
"""Test that correct list of arguments passed"""
|
||||
gh_fixture._login('my_api_token')
|
||||
|
||||
|
||||
class TestGithubRepoFixture(testtools.TestCase):
|
||||
|
||||
@mock.patch('fixtures_git.github._login',
|
||||
|
|
Loading…
Reference in New Issue