def test_userinfo(self): self.config = configuration.load(CONFIG_NAME) self.egnyte = client.EgnyteClient(self.config) data = self.egnyte.user_info self.assertEqual( data["username"], self.config['login'], "Username received from API does not match one in config file")
def __init__(self, config=None): self.config = config if isinstance(config, dict) else configuration.load(config) domain = self.config['domain'] if '.' not in domain: domain += ".egnyte.com" self._url_prefix = "https://%s/" % domain self._session = requests.Session() if 'access_token' in self.config: self._session.headers['Authorization'] = 'Bearer %s' % self.config['access_token'] if 'time_between_requests' in self.config: self.time_between_requests = config['time_between_requests'] elif 'requests_per_second' in self.config: self.time_between_requests = 1.0 / float(self.config['requests_per_second'])
def createTestCase(config_file): import unittest import hashlib from egnyte import configuration, client config = configuration.load(config_file) root_folder_name = '/Shared/integration_test_python/%s' % hashlib.sha256(config.get('access_token', '').encode('ASCII')).hexdigest() class IntegrationCase(unittest.TestCase): def setUp(self): self.client = client.EgnyteClient(self.config) self.root_folder = self.client.folder(self.root_folder_name) def tearDown(self): self.client.close() del self.client IntegrationCase.config = config IntegrationCase.root_folder_name = root_folder_name return unittest.skipUnless(config.get('access_token') and config.get('domain'), "No configuration for integration tests (%s), check doc/TESTS.md" % config_file)(IntegrationCase)
def load_config(self): if self._config is None: self._config = configuration.load(self.args.config_path) return self._config
def setUp(self): self.config = configuration.load(CONFIG_NAME) self.egnyte = client.EgnyteClient(self.config) self.user = self.egnyte.users.by_username(self.config['login']) self.groups = self.egnyte.groups self.group = self.__createGroup(self.groups, GROUP_NAME, [self.user])
def setUp(self): self.config = configuration.load(CONFIG_NAME) self.egnyte = client.EgnyteClient(self.config)
def setUp(self): self.config = configuration.load(CONFIG_NAME) self.egnyte = client.EgnyteClient(self.config) self.temp_file = NamedTemporaryFile(delete=False)
def setUp(self): self.config = configuration.load(CONFIG_NAME) self.egnyte = client.EgnyteClient(self.config) self.users = self.egnyte.users self.user = self.__create_user(self.users)
def test_userinfo(self): self.config = configuration.load(CONFIG_NAME) self.egnyte = client.EgnyteClient(self.config) data = self.egnyte.user_info self.assertEqual(data["username"], self.config['login'], "Username received from API does not match one in config file")
def setUp(self): self.config = configuration.load(CONFIG_NAME) self.egnyte = client.EgnyteClient(self.config) self.root_folder = self.egnyte.folder(ROOT_FOLDER_PATH)