def test_acquire_auth_token_ticket_headers_init(self): class MockResponse(object): text = '{"ticket": "FOO"}' cas_client = CASClient('https://dummy.url', headers={'baz': 'quux'}) assert cas_client.headers == {'baz': 'quux'} with mock.patch('requests.post') as m: m.return_value = MockResponse() cas_client.acquire_auth_token_ticket() m.assert_called_with( 'https://dummy.url/cas/api/auth_token_tickets', headers={'baz': 'quux'}, verify=False, )
def test_acquire_auth_token_ticket_no_headers(self): class MockResponse(object): text = '{"ticket": "FOO"}' cas_client = CASClient('https://dummy.url') assert not cas_client.headers with mock.patch('requests.post') as m: m.return_value = MockResponse() cas_client.acquire_auth_token_ticket() m.assert_called_with( 'https://dummy.url/cas/api/auth_token_tickets', data=None, headers=None, verify=False, )