Include RPM spec file in dist package.
[mod_auth_gssapi.git] / tests / t_spnego_no_auth.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_kerberos import HTTPKerberosAuth, OPTIONAL
7
8
9 if __name__ == '__main__':
10     sess = requests.Session()
11     url = 'http://%s/spnego/' % os.environ['NSS_WRAPPER_HOSTNAME']
12
13     r = sess.get(url)
14     if r.status_code != 401:
15         raise ValueError('Spnego failed - 401 expected')
16
17     if not (r.headers.get("WWW-Authenticate") and
18             r.headers.get("WWW-Authenticate").startswith("Negotiate")):
19         raise ValueError('Spnego failed - WWW-Authenticate Negotiate header '
20                          'missing')
21