def sync(info, data): """ Sync Jumpcloud with a data file """ click.echo("Sync data on jumpcloud with data in " + data) users = get_users_from_file(data) groups = get_groups_from_file(data) if users is None: raise MissingRequiredArgumentError("A sync requires a config file") sync_users(info.key, users)
def sync(ctx, dry_run, data): # pylint: disable-msg=too-many-locals # pylint: disable-msg=too-many-branches """ Sync Jumpcloud with a data file """ if dry_run: LOGGER.setLevel(logging.DEBUG) LOGGER.debug("--- sync groups ----") groups = jccli_helpers.get_groups_from_file(data) sync_groups(ctx, groups) LOGGER.debug("--- sync users ----") users = jccli_helpers.get_users_from_file(data) sync_users(ctx, users)
def test_get_users_from_file_no_users_in_data(self): users = jccli_helpers.get_users_from_file(TEST_DATA_PATH+"test_data_no_users.json") assert (len(users) == 0), "Invalid number of users"
def test_get_users_from_file_no_file(self): with pytest.raises(FileNotFoundError): users = jccli_helpers.get_users_from_file(TEST_DATA_PATH+"invalid.json")