Пример #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
Пример #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
Пример #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
Пример #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
Пример #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
Пример #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
Пример #7
0
 def test_AliasRequest_alias(self):
     dnStr = 'uni/tn-mgmt'
     aliasStr = 'alias1'
     ar = AliasRequest(dnStr)
     ar.alias = aliasStr
     assert ar.alias == aliasStr
Пример #8
0
 def test_AliasRequest_dnStr(self):
     dnStr = 'uni/tn-common'
     aliasStr = 'alias1'
     ar = AliasRequest(dnStr, alias=aliasStr)
     assert ar.dnStr == dnStr
Пример #9
0
 def test_AliasRequest_data(self):
     dnStr = 'uni'
     tr = AliasRequest(dnStr)
     assert tr.data == '{}'
Пример #10
0
 def test_AliasRequest_init(self):
     assert isinstance(AliasRequest('fvTenant'), AliasRequest)
Пример #11
0
 def test_AliasRequest_alias(self):
     dnStr = 'uni/tn-mgmt'
     aliasStr = 'alias1'
     ar = AliasRequest(dnStr)
     ar.alias = aliasStr
     assert ar.alias == aliasStr