Exemple #1
0
 def test_AliasRequest_options(self):
     aid = '1234567890'
     dnStr = 'system'
     aliasStr = 'alias1'
     ar = AliasRequest(dnStr, alias=aliasStr)
     expectedOptions = 'set=' + aliasStr
     ar.id = aid
     expectedOptions += '&_dc=' + aid
     assert ar.options == expectedOptions
Exemple #2
0
 def test_AliasRequest_options(self):
     aid = '1234567890'
     dnStr = 'system'
     aliasStr = 'alias1'
     ar = AliasRequest(dnStr, alias=aliasStr)
     expectedOptions = 'set=' + aliasStr
     ar.id = aid
     expectedOptions += '&_dc=' + aid
     assert ar.options == expectedOptions
Exemple #3
0
 def test_AliasRequest_requestargs(self):
     expected = {
                    'data': '{}',
                    'headers': {
                        'Cookie': 'APIC-cookie=None'
                    },
                    'timeout': 90,
                    'verify': False
                }
     session = LoginSession('http://1.1.1.1', 'admin', 'password')
     dnStr = 'uni'
     aliasStr = 'alias1'
     tr = AliasRequest(dnStr, aliasStr)
     assert tr.requestargs(session) == expected
Exemple #4
0
 def test_AliasRequest_requestargs(self):
     expected = {
                    'data': '{}',
                    'headers': {
                        'Cookie': 'APIC-cookie=None'
                    },
                    'timeout': 90,
                    'verify': False
                }
     session = LoginSession('http://1.1.1.1', 'admin', 'password')
     dnStr = 'uni'
     aliasStr = 'alias1'
     tr = AliasRequest(dnStr, aliasStr)
     assert tr.requestargs(session) == expected
Exemple #5
0
 def test_AliasRequest_getUrl(self, sessionUrl, dc, aliasStr, clear,
                              requestType):
     dnStr = 'uni'
     session = LoginSession(sessionUrl, 'admin', 'password',
                            requestFormat=requestType)
     ar = AliasRequest(dnStr)
     expectedUrl = sessionUrl + '/api/alias/mo/' + dnStr + '.' + requestType
     if clear:
         ar.alias = aliasStr
         ar.clear()
         expectedUrl += '?clear=yes'
     else:
         ar.alias = aliasStr
         expectedUrl += '?set=' + aliasStr
     ar.id = dc
     expectedUrl += '&_dc=' + dc
     assert ar.getUrl(session) == expectedUrl
Exemple #6
0
 def test_AliasRequest_getUrl(self, sessionUrl, dc, aliasStr, clear,
                              requestType):
     dnStr = 'uni'
     session = LoginSession(sessionUrl, 'admin', 'password',
                            requestFormat=requestType)
     ar = AliasRequest(dnStr)
     expectedUrl = sessionUrl + '/api/alias/mo/' + dnStr + '.' + requestType
     if clear:
         ar.alias = aliasStr
         ar.clear()
         expectedUrl += '?clear=yes'
     else:
         ar.alias = aliasStr
         expectedUrl += '?set=' + aliasStr
     ar.id = dc
     expectedUrl += '&_dc=' + dc
     assert ar.getUrl(session) == expectedUrl
Exemple #7
0
 def test_AliasRequest_alias(self):
     dnStr = 'uni/tn-mgmt'
     aliasStr = 'alias1'
     ar = AliasRequest(dnStr)
     ar.alias = aliasStr
     assert ar.alias == aliasStr
Exemple #8
0
 def test_AliasRequest_dnStr(self):
     dnStr = 'uni/tn-common'
     aliasStr = 'alias1'
     ar = AliasRequest(dnStr, alias=aliasStr)
     assert ar.dnStr == dnStr
Exemple #9
0
 def test_AliasRequest_data(self):
     dnStr = 'uni'
     tr = AliasRequest(dnStr)
     assert tr.data == '{}'
Exemple #10
0
 def test_AliasRequest_init(self):
     assert isinstance(AliasRequest('fvTenant'), AliasRequest)
Exemple #11
0
 def test_AliasRequest_alias(self):
     dnStr = 'uni/tn-mgmt'
     aliasStr = 'alias1'
     ar = AliasRequest(dnStr)
     ar.alias = aliasStr
     assert ar.alias == aliasStr