Add option to not send a Negotiate headers
[mod_auth_gssapi.git] / tests / t_basic_k5_two_users.py
1 #!/usr/bin/python
2 # Copyright (C) 2015 - mod_auth_gssapi contributors, see COPYING for license.
3
4 import os
5 import requests
6 from requests.auth import HTTPBasicAuth
7
8
9 if __name__ == '__main__':
10     s = requests.Session()
11
12     url = 'http://%s:%s@%s/basic_auth_krb5/' % (os.environ['MAG_USER_NAME'],
13                                                 os.environ['MAG_USER_PASSWORD'],
14                                                 os.environ['NSS_WRAPPER_HOSTNAME'])
15     r = s.get(url)
16     if r.status_code != 200:
17         raise ValueError('Basic Auth Failed')
18
19     url = 'http://%s:%s@%s/basic_auth_krb5/' % (os.environ['MAG_USER_NAME_2'],
20                                                 os.environ['MAG_USER_PASSWORD_2'],
21                                                 os.environ['NSS_WRAPPER_HOSTNAME'])
22     r2 = s.get(url)
23     if r2.status_code != 200:
24         raise ValueError('Basic Auth failed')
25
26     if r.text == r2.text:
27          raise ValueError('Basic Auth fatal error')