def testInvalidType(self): t = eApiType.EO_V1 + "hello.world!" assert not eApiType.isValid(t) try: ApiFactory.get(t) except ApiParamError, e: assert e.item == t assert eApiType in e.allowedTypes assert len(e.allowedTypes) == 1
def testValid(self): t = eApiType.EO_V1 assert eApiType.isValid(t) api_ = ApiFactory.get(t) self.apis.append(api_) assert isinstance(api_, iApi) t = eApiType.EO_V1__HANDLER assert eApiType.isValid(t) api_ = ApiFactory.get(t) self.apis.append(api_) assert isinstance(api_, iApi)
def testUnsupported(self): t = eApiType.UNSUPPORTED try: ApiFactory.get(t) except UnknownApiError, _e: assert True