-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
sample-macro-script.txt
48 lines (38 loc) · 1.45 KB
/
sample-macro-script.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# This script shows what can be done with tn-cli macros. Run it as
#
# python tn-cli.py --no-login < sample-macro-script.txt
#
# The script performs the following:
#
# - Creates a new user Test User with useradd
# - Logs in as Xena (user has root privileges)
# - Changes Test User's name to 'Test User 1'
# - Modifies Test User's default anon acs to JR with chacs
# - Sets Test User's password to test456
# - Deletes Test User with userdel
# - Uses resolve to locate user Alice
# - Subscribes to Alice
# - Sends a message to Alice
# Create user 'Test User'
# .must directive ensures the command succeeds (in case of failure, the script execution stops.
# $user is the variable that will hold the result of the command execution.
.must $user useradd --name 'Test User' --password test123 --comment test0 \
--cred email:[email protected] --avatar ./test-128.jpg --tags test,test-user \
--auth=JRWPA --anon=JW test
# Login as xena.
.must $xena login --scheme=basic --secret=xena:xena123
# Change test's public name.
.must usermod $user.params[user] --name 'Test User 1'
# Change test's anon acs.
.must chacs $user.params[user] --anon=JR
# Set test's password to test456.
passwd $user.params[user] -P test456
# Delete test user.
.must userdel $user.params[user] --hard
# Find Alice.
.must $alice resolve alice
# Subscribe to Alice
.must sub $alice.sub[0].user_id
# Send a plain text message to Alice (async)
pub $alice.sub[0].user_id 'Hello, Alice'
.sleep 2000