def test_get_realm_bad_request(): with patch('requests.Response') as mock: mock.headers = {'www-authenticate': ''} res = http._get_realm(mock) assert res is None
def test_get_realm_good_request(): with patch('requests.Response') as mock: mock.headers = {'www-authenticate': 'Basic realm="Restricted"'} res = http._get_realm(mock) assert res == "restricted"