def create_user(ctx, json, file): """ Create a new Jumpcloud user """ api1 = JumpcloudApiV1(ctx.obj.get('key')) user = {} if json is not None: user = jccli_helpers.get_user_from_term(json) elif file is not None: user = jccli_helpers.get_user_from_file(file) else: raise MissingRequiredArgumentError( "SystemUser properties not provided") response = api1.create_user(user) LOGGER.info(f"{response}")
def create_user(info, json, file): """ Create a new Jumpcloud user """ api1 = JumpcloudApiV1(info.key) user = {} if json is not None: user = get_user_from_term(json) elif file is not None: user = get_user_from_file(file) else: raise MissingRequiredArgumentError("SystemUser properties not provided") click.echo("Create jumpcloud user " + user['username']) response = api1.create_user(user) click.echo(response)
def test_get_user_from_file_valid_json(self): user = jccli_helpers.get_user_from_term("{\"email\": \"[email protected]\", \"username\": \"jctester1\"}") assert (user['email'] == "*****@*****.**" and user['username'] =="jctester1"), "Failed to get user definition"