Exemple #1
0
 def test_realm(self):
     element = Auth(username='******', password='******', realm='realm')
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['result']['elementProp']['stringProp']:
         if tag['@name'] == 'Authorization.realm':
             assert tag['#text'] == 'realm'
Exemple #2
0
 def test_url(self):
     element = Auth(username='******',
                    password='******',
                    url='http://121.0.0.1:8097/request')
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['result']['elementProp']['stringProp']:
         if tag['@name'] == 'Authorization.url':
             assert tag['#text'] == 'http://121.0.0.1:8097/request'
Exemple #3
0
 def test_mechanism(self):
     element = Auth(username='******',
                    password='******',
                    mechanism=AuthMechanism.KERBEROS)
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['result']['elementProp']['stringProp']:
         if tag['@name'] == 'Authorization.mechanism':
             assert tag['#text'] == 'KERBEROS'
Exemple #4
0
 def test_auth(self):
     element = HTTPAuthManager(auth_list=[Auth(username='******', password='******'),\
                                         Auth(username='******', password='******')])
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['result']['AuthManager']['collectionProp'][
             'elementProp']:
         if tag['@name'] == 'var':
             assert tag['stringProp'][1]['#text'] == 'var'
             assert tag['stringProp'][2]['#text'] == '12'
Exemple #5
0
 def test_type_check(self):
     with pytest.raises(TypeError):
         Auth(username=123, password='******')
Exemple #6
0
 def test_positive(self):
     Auth(username='******', password='******', mechanism=AuthMechanism.BASIC)
Exemple #7
0
 def test_type_check(self):
     with pytest.raises(TypeError):
         Auth(username='******', password='******', mechanism='BASIC')
Exemple #8
0
 def test_positive(self):
     Auth(username='******', password='******', realm='s')
Exemple #9
0
 def test_type_check(self):
     with pytest.raises(TypeError):
         Auth(username='******', password='******', realm=1)
Exemple #10
0
 def test_positive(self):
     Auth(username='******', password='******', url='https://google.com/')
Exemple #11
0
 def test_positive(self):
     Auth(username='******', password='******', domain='1')
Exemple #12
0
 def test_hashtree_contain(self):
     element = HTTPAuthManager(auth_list=[Auth(username='******', password='******'),\
                                         Auth(username='******', password='******')])
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     assert '<hashTree />' in rendered_doc
Exemple #13
0
 def test_positive1(self):
     HTTPAuthManager(auth_list=[Auth(username='******', password='******'),\
                                     Auth(username='******', password='******')])
Exemple #14
0
 def test_type_check5(self):
     with pytest.raises(TypeError):
         HTTPAuthManager(
             auth_list=[Auth(username='******', password='******'), '23'])