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
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
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
def test_AliasRequest_alias(self): dnStr = 'uni/tn-mgmt' aliasStr = 'alias1' ar = AliasRequest(dnStr) ar.alias = aliasStr assert ar.alias == aliasStr
def test_AliasRequest_dnStr(self): dnStr = 'uni/tn-common' aliasStr = 'alias1' ar = AliasRequest(dnStr, alias=aliasStr) assert ar.dnStr == dnStr
def test_AliasRequest_data(self): dnStr = 'uni' tr = AliasRequest(dnStr) assert tr.data == '{}'
def test_AliasRequest_init(self): assert isinstance(AliasRequest('fvTenant'), AliasRequest)