def test_api_different_host_in_provider_url(self, gitlab_mock): url = 'localhost' token = 'foo' prov = Provider(bundle=RequirementsBundle(), url=url) prov._api(token) gitlab_mock.assert_called_once_with(url, token, ssl_verify=True)
def test_ignore_ssl_should_be_default_false(self, gitlab_mock): provider = Provider(bundle=Mock()) provider._api("foo") self.assertFalse(provider.ignore_ssl) gitlab_mock.assert_called_once_with("https://gitlab.com", "foo", ssl_verify=True)
def test_ignore_ssl(self, gitlab_mock): ignore_ssl = True provider = Provider(bundle=RequirementsBundle(), ignore_ssl=ignore_ssl) provider._api("foo") self.assertTrue(provider.ignore_ssl) gitlab_mock.assert_called_once_with("https://gitlab.com", "foo", ssl_verify=(not ignore_ssl))
def test_api_different_host(self, github_mock): prov = Provider(bundle=RequirementsBundle()) prov._api("foo@localhost") github_mock.assert_called_once_with("localhost", "foo")
def test_api(self, github_mock): prov = Provider(bundle=RequirementsBundle()) prov._api("foo") github_mock.assert_called_once_with("https://gitlab.com", "foo")
def setUp(self): self.provider = Provider(bundle=Mock()) self.provider._api = Mock() self.repo = Mock()
def test_api_different_host_in_token(self, gitlab_mock): prov = Provider(bundle=RequirementsBundle()) prov._api("foo@localhost") gitlab_mock.assert_called_once_with("localhost", "foo", ssl_verify=True)