def setUp(self): super(PlotlyApiTestCase, self).setUp() self.username = '******' self.api_key = 'bar' self.proxy_username = '******' self.proxy_password = '******' self.stream_ids = ['heyThere'] self.plotly_api_domain = 'https://api.do.not.exist' self.plotly_domain = 'https://who.am.i' self.plotly_proxy_authorization = False self.plotly_streaming_domain = 'stream.does.not.exist' self.plotly_ssl_verification = True sign_in(username=self.username, api_key=self.api_key, proxy_username=self.proxy_username, proxy_password=self.proxy_password, stream_ids=self.stream_ids, plotly_domain=self.plotly_domain, plotly_api_domain=self.plotly_api_domain, plotly_streaming_domain=self.plotly_streaming_domain, plotly_proxy_authorization=self.plotly_proxy_authorization, plotly_ssl_verification=self.plotly_ssl_verification)
def setUp(self): super(PlotlyApiTestCase, self).setUp() self.username = "******" self.api_key = "bar" self.proxy_username = "******" self.proxy_password = "******" self.stream_ids = ["heyThere"] self.plotly_api_domain = "https://api.do.not.exist" self.plotly_domain = "https://who.am.i" self.plotly_proxy_authorization = False self.plotly_streaming_domain = "stream.does.not.exist" self.plotly_ssl_verification = True sign_in( username=self.username, api_key=self.api_key, proxy_username=self.proxy_username, proxy_password=self.proxy_password, stream_ids=self.stream_ids, plotly_domain=self.plotly_domain, plotly_api_domain=self.plotly_api_domain, plotly_streaming_domain=self.plotly_streaming_domain, plotly_proxy_authorization=self.plotly_proxy_authorization, plotly_ssl_verification=self.plotly_ssl_verification, )
def test_proxy_auth(self): sign_in(self.username, self.api_key, plotly_proxy_authorization=True) headers = utils.get_headers() expected_headers = { 'authorization': 'Basic a2xlZW4ta2FudGVlbjpoeWRyYXRlZA==' } self.assertEqual(headers, expected_headers)
def setUp(self): self.stash_session() self.stash_files() defaults = dict( files.FILE_CONTENT[files.CREDENTIALS_FILE], **files.FILE_CONTENT[files.CONFIG_FILE] ) session.sign_in(**defaults)
def setUp(self): super(GetHeadersTest, self).setUp() self.domain = 'https://foo.bar' self.username = '******' self.api_key = 'secret' sign_in(self.username, self.api_key, proxy_username='******', proxy_password='******', plotly_proxy_authorization=False)
def test_proxy_auth(self): sign_in(self.username, self.api_key, plotly_proxy_authorization=True) headers = utils.get_headers() expected_headers = { 'plotly-client-platform': 'python {}'.format(version.stable_semver()), 'authorization': 'Basic Y25ldDpob29wbGE=', 'plotly-authorization': 'Basic Zm9vOmJhcg==', 'content-type': 'application/json' } self.assertEqual(headers, expected_headers)
def test_proxy_auth(self): sign_in(self.username, self.api_key, plotly_proxy_authorization=True) headers = utils.get_headers() expected_headers = { "plotly-client-platform": "python {}".format(version.stable_semver()), "authorization": "Basic Y25ldDpob29wbGE=", "plotly-authorization": "Basic Zm9vOmJhcg==", "content-type": "application/json", } self.assertEqual(headers, expected_headers)
def setUp(self): super(RequestTest, self).setUp() self.domain = 'https://foo.bar' self.username = '******' self.api_key = 'secret' sign_in(self.username, self.api_key, proxy_username='******', proxy_password='******', plotly_proxy_authorization=False) # Mock the actual api call, we don't want to do network tests here. patcher = patch('chart_studio.api.v1.utils.requests.request') self.request_mock = patcher.start() self.addCleanup(patcher.stop) self.request_mock.return_value = MagicMock(Response) # Mock the validation function since we test that elsewhere. patcher = patch('chart_studio.api.v1.utils.validate_response') self.validate_response_mock = patcher.start() self.addCleanup(patcher.stop) self.method = 'get' self.url = 'https://foo.bar.does.not.exist.anywhere'
def setUp(self): self.stash_session() self.stash_files() defaults = dict(files.FILE_CONTENT[files.CREDENTIALS_FILE], **files.FILE_CONTENT[files.CONFIG_FILE]) session.sign_in(**defaults)