Пример #1
0
    def test_create_header_custom_proxy_authorization(self):
        username = None
        password = None
        custom_proxy_authorization = 'Basic dXNlcm5hbWU6cGFzc3dvcmQ='

        headers = _create_auth_header(username, password, custom_proxy_authorization)

        self.assertEqual(headers, {'Proxy-Authorization': 'Basic dXNlcm5hbWU6cGFzc3dvcmQ='})
Пример #2
0
    def test_create_header_quoted(self):
        username = '******'
        password = '******'
        custom_proxy_authorization = None

        headers = _create_auth_header(username, password, custom_proxy_authorization)

        self.assertEqual(headers, {'Proxy-Authorization': 'Basic dXNlcm5hbWU7OnBhc3N3b3JkOw=='})
Пример #3
0
    def test_create_header_missing_password(self):
        username = '******'
        password = None
        custom_proxy_authorization = None

        headers = _create_auth_header(username, password, custom_proxy_authorization)

        self.assertEqual(headers, {})
Пример #4
0
    def test_does_not_create_headers_when_missing_username(self):
        username = None
        password = '******'
        custom_proxy_authorization = None

        headers = _create_auth_header(username, password,
                                      custom_proxy_authorization)

        self.assertEqual(headers, {})