def __init__(self, endpoint, username, password, token, insecure_upload=False): """ Client constructor. In order to create a client, the URL to a ComodIT server's REST API (e.g. http://my.comodit.com/api) must be provided, in addition to connection credentials (username and password). @param endpoint: The URL of a ComodIT server's REST API. @type endpoint: String @param username: A user name @type username: String @param password: A password @type password: String @param token: A token @type token: String """ self._http_client = HttpClient(endpoint, username, password, token, insecure_upload) self._organizations = OrganizationCollection(self) self._flavors = FlavorCollection(self) self._app_store = AppStoreCollection(self) self._dist_store = DistStoreCollection(self)
def setUp(self): self._url = "url" self._params = "" self._api = "http://localhost/api" self._user = "******" self._pass = "******" self._headers = None self._urlopen_result = None self._client = HttpClient(self._api, self._user, self._pass) # Mock some Client methods self._client._new_request = self._new_request self._client._new_request_with_data = self._new_request_with_data