-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheggdrop_tcl_matchattr.bats
154 lines (126 loc) · 5.57 KB
/
eggdrop_tcl_matchattr.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
@test "Eggdrop setup" {
cd $HOME/eggdrop
run cp $WORK_DIR/tests/eggdrop_tcl_matchattr* $HOME/eggdrop/
[ $status -eq 0 ]
run cp $WORK_DIR/tests/cmd_accept.tcl $HOME/eggdrop/scripts/
[ $status -eq 0 ]
run ./eggdrop -m eggdrop_tcl_matchattr.conf
[ $status -eq 0 ]
echo "{deluser foo}" |nc localhost 45678
run bash -c 'echo "{channel add #foober}" |nc localhost 45678'
[[ ${output} == *"0 {}"* ]]
run bash -c 'echo "{adduser foo}" |nc localhost 45678'
echo "HI $output"
[[ ${output} == *"0 {1}"* ]]
run bash -c 'echo "{chattr foo +jlmoptx|+lov #foober}" |nc localhost 45678'
[[ ${output} == *"0 {jlmoptx|lov}"* ]]
}
@test "matchattr with single global + flag returns 1 on user possessing global flag" {
run bash -c 'echo "{matchattr foo +o}" |nc localhost 45678'
[[ ${output} == *"0 {1}"* ]]
}
@test "matchattr with single global + flag returns 0 on user not possessing global flag" {
run bash -c 'echo "{matchattr foo +g}" |nc localhost 45678'
[[ ${output} == *"0 {0}"* ]]
}
@test "matchattr with 2 + global flags returns 1 on user possessing one of the global flags" {
run bash -c 'echo "{matchattr foo +on}" |nc localhost 45678'
[[ ${output} == *"0 {1}"* ]]
}
@test "matchattr with 2 + global flags returns 0 on user not possessing either global flags" {
run bash -c 'echo "{matchattr foo +gn}" |nc localhost 45678'
[[ ${output} == *"0 {0}"* ]]
}
@test "matchattr with 2 + channel flags returns 1 if & specified and user has both global flags" {
run bash -c 'echo "{matchattr foo +mo& #foober}" |nc localhost 45678'
[[ ${output} == *"0 {1}"* ]]
}
@test "matchattr with 2 + channels flags returns 0 if & specified and user has one global flag" {
run bash -c 'echo "{matchattr foo +mn& #foober}" |nc localhost 45678'
[[ ${output} == *"0 {0}"* ]]
}
@test "matchattr with single global - flag returns 1 on user not possessing global flag" {
run bash -c 'echo "{matchattr foo -n}" |nc localhost 45678'
[[ ${output} == *"0 {1}"* ]]
}
@test "matchattr with single global - flag returns 0 on user possessing global flag" {
run bash -c 'echo "{matchattr foo -m}" |nc localhost 45678'
[[ ${output} == *"0 {0}"* ]]
}
@test "matchattr with 2 - global flags returns 1 on user not posessing one of the global flags" {
run bash -c 'echo "{matchattr foo -mn}" |nc localhost 45678'
[[ ${output} == *"0 {1}"* ]]
}
@test "matchattr with 2 - global flags returns 1 on user not possessing both global flags" {
run bash -c 'echo "{matchattr foo -gn}" |nc localhost 45678'
[[ ${output} == *"0 {1}"* ]]
}
@test "matchattr with 2 - global flags returns 0 on user possessing both global flags" {
run bash -c 'echo "{matchattr foo -om}" |nc localhost 45678'
[[ ${output} == *"0 {0}"* ]]
}
@test "matchattr with single channel + flag returns 1 on user possessing channel flag" {
run bash -c 'echo "{matchattr foo |+o #foober}" |nc localhost 45678'
[[ ${output} == *"0 {1}"* ]]
}
@test "matchattr with single channel + flag returns 0 on user not possessing channel flag" {
run bash -c 'echo "{matchattr foo |+g #foober}" |nc localhost 45678'
[[ ${output} == *"0 {0}"* ]]
}
@test "matchattr with 2 + channel flags returns 1 on user possessing one of the channel flags" {
run bash -c 'echo "{matchattr foo |+on #foober}" |nc localhost 45678'
[[ ${output} == *"0 {1}"* ]]
}
@test "matchattr with 2 + channel flags returns 0 on user not possessing either channel flag" {
run bash -c 'echo "{matchattr foo |+gn #foober}" |nc localhost 45678'
[[ ${output} == *"0 {0}"* ]]
}
@test "matchattr with 2 + channel flags returns 1 if & specified and user has both channel flags" {
run bash -c 'echo "{matchattr foo &+lo #foober}" |nc localhost 45678'
[[ ${output} == *"0 {1}"* ]]
}
@test "matchattr with 2 + channels flags returns 0 if & specified and user has one channel flag" {
run bash -c 'echo "{matchattr foo &+om #foober}" |nc localhost 45678'
[[ ${output} == *"0 {0}"* ]]
}
@test "matchattr with single channel - flag returns 1 on user not possessing channel flag" {
run bash -c 'echo "{matchattr foo |-n #foober}" |nc localhost 45678'
[[ ${output} == *"0 {1}"* ]]
}
@test "matchattr with single channel - flag returns 0 on user possessing channel flag" {
run bash -c 'echo "{matchattr foo |-o #foober}" |nc localhost 45678'
[[ ${output} == *"0 {0}"* ]]
}
@test "matchattr with 2 - channel flags returns 1 on user not posessing one of the channel flags" {
run bash -c 'echo "{matchattr foo |-on #foober}" |nc localhost 45678'
[[ ${output} == *"0 {1}"* ]]
}
@test "matchattr with 2 - channel flags returns 1 on user not possessing both channel flags" {
run bash -c 'echo "{matchattr foo |-gn #foober}" |nc localhost 45678'
[[ ${output} == *"0 {1}"* ]]
}
@test "matchattr with 2 - channel flags returns 0 on user possessing both channel flags" {
run bash -c 'echo "{matchattr foo |-ov #foober}" |nc localhost 45678'
[[ ${output} == *"0 {0}"* ]]
}
@test "matchattr rejects invalid global flags" {
run bash -c 'echo "{matchattr foo +s}" |nc localhost 45678'
[[ ${output} == *"1 {Unknown flag specified for matching}"* ]]
}
@test "matchattr rejects invalid channel flags" {
run bash -c 'echo "{matchattr foo |+j #foober}" |nc localhost 45678'
[[ ${output} == *"1 {Unknown flag specified for matching}"* ]]
}
@test "matchattr rejects invalid bot flags" {
run bash -c 'echo "{matchattr foo ||+f}" |nc localhost 45678'
[[ ${output} == *"1 {Unknown flag specified for matching}"* ]]
}
@test "Kill Eggdrop" {
ps x|grep "[e]ggdrop "
if [ $? -eq 0 ]; then
pkill eggdrop
fi
if [ -e /home/eggdrop/eggdrop/tempuser.user ]; then
rm /home/eggdrop/eggdrop/tempsuer.user
fi
}