def test_TagsRequest_options(self): tid = '1234567890' dnStr = 'system' tr = TagsRequest(dnStr, add=u'tag1', remove=u'tag2') expectedOptions1 = 'add=tag1&remove=tag2' expectedOptions2 = 'remove=tag2&add=tag1' tr.id = tid expectedOptions1 += '&_dc=' + tid expectedOptions2 += '&_dc=' + tid assert (tr.options == expectedOptions1 or tr.options == expectedOptions2)
def test_TagsRequest_options(self): tid = '1234567890' dnStr = 'system' tr = TagsRequest(dnStr, add=u'tag1', remove=u'tag2') expectedOptions1 = 'add=tag1&remove=tag2' expectedOptions2 = 'remove=tag2&add=tag1' tr.id = tid expectedOptions1 += '&_dc=' + tid expectedOptions2 += '&_dc=' + tid assert (tr.options == expectedOptions1 or tr.options == expectedOptions2)
def test_TagsRequest_getUrl(self, sessionUrl, dc, requestType): dnStr = 'uni' session = LoginSession(sessionUrl, 'admin', 'password', requestFormat=requestType) tr = TagsRequest(dnStr) expectedUrl = sessionUrl + '/api/tag/mo/' + dnStr + '.' + requestType tr.add = [u'tag1', u'tag2'] tr.remove = u'tag3' tr.id = dc expectedUrl1 = expectedUrl + '?add=tag1,tag2&remove=tag3&_dc=' + dc expectedUrl2 = expectedUrl + '?remove=tag3&add=tag1,tag2&_dc=' + dc assert (tr.getUrl(session) == expectedUrl1 or tr.getUrl(session) == expectedUrl2)
def test_TagsRequest_getUrl(self, sessionUrl, dc, requestType): dnStr = 'uni' session = LoginSession(sessionUrl, 'admin', 'password', requestFormat=requestType) tr = TagsRequest(dnStr) expectedUrl = sessionUrl + '/api/tag/mo/' + dnStr + '.' + requestType tr.add = [u'tag1', u'tag2'] tr.remove = u'tag3' tr.id = dc expectedUrl1 = expectedUrl + '?add=tag1,tag2&remove=tag3&_dc=' + dc expectedUrl2 = expectedUrl + '?remove=tag3&add=tag1,tag2&_dc=' + dc assert (tr.getUrl(session) == expectedUrl1 or tr.getUrl(session) == expectedUrl2)