-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsuperuser.bats
67 lines (55 loc) · 1.25 KB
/
superuser.bats
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bats
load "helpers"
setup_file() {
start_server
login_superadmin
}
teardown_file() {
stop_server
}
@test "superuser: can create bank manager" {
bank_manager_email=$(generate_email)
variables=$(
jq -n \
--arg email "$bank_manager_email" \
'{
input: {
email: $email
}
}'
)
exec_admin_graphql 'user-create' "$variables"
user_id=$(graphql_output .data.userCreate.user.userId)
[[ "$user_id" != "null" ]] || exit 1
variables=$(
jq -n \
--arg userId "$user_id" \
'{
input: {
id: $userId,
role: "BANK_MANAGER"
}
}'
)
exec_admin_graphql 'user-assign-role' "$variables"
role=$(graphql_output .data.userAssignRole.user.roles[0])
[[ "$role" = "BANK_MANAGER" ]] || exit 1
}
@test "superuser: can create customer" {
customer_email=$(generate_email)
telegramId=$(generate_email)
variables=$(
jq -n \
--arg email "$customer_email" \
--arg telegramId "$telegramId" \
'{
input: {
email: $email,
telegramId: $telegramId
}
}'
)
exec_admin_graphql 'customer-create' "$variables"
customer_id=$(graphql_output .data.customerCreate.customer.customerId)
[[ "$customer_id" != "null" ]] || exit 1
}