Skip to content

Commit

Permalink
Add test_authenticate_enterprise_token method
Browse files Browse the repository at this point in the history
  • Loading branch information
donnemartin committed May 23, 2016
1 parent 45a8704 commit 5572234
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ def verify_login_token_url_enterprise(self, username=None, password=None,
assert two_factor_callback is not None
assert verify

def verify_login_token_url_no_verify_enterprise(self, username=None,
password=None, token=None,
url=None,
two_factor_callback=None,
verify=True):
assert username is not None
assert token is not None
assert url is not None
assert two_factor_callback is not None
assert not verify

def verify_login_pass_url_enterprise(self, username=None, password=None,
token=None, url=None,
two_factor_callback=None,
Expand Down Expand Up @@ -157,6 +168,20 @@ def test_authenticate_pass(self, mock_auth, mock_click_secho):
enterprise=False,
overwrite=True)

@mock.patch('gitsome.github.click.secho')
@mock.patch('gitsome.config.Config.authenticate_cached_credentials')
def test_authenticate_enterprise_token(self, mock_auth, mock_click_secho):
with mock.patch('click.confirm', return_value=False):
with mock.patch('builtins.input', return_value='foo'):
self.github.config.user_login = 'foo'
self.github.config.user_token = 'bar'
enterprise_auth = \
self.verify_login_token_url_no_verify_enterprise
self.github.config.authenticate(
enterprise=True,
enterprise_auth=enterprise_auth,
overwrite=True)

@mock.patch('gitsome.github.click.secho')
def test_check_auth_error(self, mock_click_secho):
self.github.config.api = None
Expand Down

0 comments on commit 5572234

Please sign in to comment.