-
Notifications
You must be signed in to change notification settings - Fork 0
/
eggdrop_tcl_iscmds.bats
242 lines (202 loc) · 9.7 KB
/
eggdrop_tcl_iscmds.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
iscmd00() {
echo "{$2 *!test@foo.com $4 $5}" |nc localhost 45678
echo "{$3 #foober *!test@foo.com}" |nc localhost 45678
run bash -c 'echo "{$1 *!test@foo.com}" |nc localhost 45678'
}
@test "Eggdrop setup" {
cd $HOME/eggdrop
run cp $WORK_DIR/tests/eggdrop_tcl_iscmds* $HOME/eggdrop/
echo "1 $output"
[ $status -eq 0 ]
run cp $WORK_DIR/tests/cmd_accept.tcl $HOME/eggdrop/scripts/
echo "2 $output"
[ $status -eq 0 ]
run ./eggdrop -m eggdrop_tcl_iscmds.conf
echo "3 $output"
[ $status -eq 0 ]
run bash -c 'echo "{channel add #foober}" |nc localhost 45678'
}
###############
### Check isban
###############
@test "isban returns 0 if global and channel bans DNE" {
echo "{killban *!test@foo.com}" |nc localhost 45678
echo "{killchanban #foober *!test@foo.com}" |nc localhost 45678
run bash -c 'echo "{isban *!test@foo.com}" |nc localhost 45678'
[[ "${output}" == *"0 {0}"* ]]
}
@test "isban returns 1 if only global ban is present" {
echo "{newban *!test@foo.com testuser comment}" |nc localhost 45678
echo "{killchanban #foober *!test@foo.com}" |nc localhost 45678
run bash -c 'echo "{isban *!test@foo.com}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "isban #channel returns 1 if only channel ban is present" {
echo "{killban *!test@foo.com}" |nc localhost 45678
echo "{newchanban #foober *!test@foo.com testuser comment}" |nc localhost 45678
run bash -c 'echo "{isban *!test@foo.com #foober}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "isban returns 1 if global and channel ban is present" {
echo "{newban #foober *!test@foo.com testuser comment}" |nc localhost 45678
echo "{newchanban #foober *!test@foo.com testuser comment}" |nc localhost 45678
run bash -c 'echo "{isban *!test@foo.com #foober}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "isban #channel returns 1 if global and channel ban is present" {
echo "{newchanban #foober *!test@foo.com testuser comment}" |nc localhost 45678
echo "{newban *!test@foo.com testuser comment}" |nc localhost 45678
run bash -c 'echo "{isban *!test@foo.com}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "isban #channel returns 0 if only global ban is present" {
echo "{killchanban #foober *!test@foo.com}" |nc localhost 45678
echo "{newban *!test@foo.com testuser comment}" |nc localhost 45678
run bash -c 'echo "{isban *!test@foo.com #foober}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "isban returns 0 if only channel ban is present" {
echo "{killban *!test@foo.com}" |nc localhost 45678
echo "{newchanban #foober *!test@foo.com testuser comment}" |nc localhost 45678
run bash -c 'echo "{isban *!test@foo.com}" |nc localhost 45678'
[[ "${output}" == *"0 {0}"* ]]
}
#####################
### Check sticky bans
#####################
@test "isbansticky returns 0 if global and channel bans DNE" {
echo "{killchanban #foober *!test@foo.com}" |nc localhost 45678
echo "{killban *!test@foo.com}" |nc localhost 45678
run bash -c 'echo "{isbansticky *!test@foo.com}" |nc localhost 45678'
[[ "${output}" == *"0 {0}"* ]]
}
@test "isbansticky returns 1 if only global ban is present" {
echo "{killchanban #foober *!test@foo.com}" |nc localhost 45678
echo "{newban *!test@foo.com testuser comment 60 sticky}" |nc localhost 45678
run bash -c 'echo "{isbansticky *!test@foo.com}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "isbansticky #channel returns 1 if only channel ban is present" {
echo "{killban *!test@foo.com}" |nc localhost 45678
echo "{newchanban #foober *!test@foo.com testuser commenti 60 sticky}" |nc localhost 45678
run bash -c 'echo "{isbansticky *!test@foo.com #foober}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "isbansticky returns 1 if global and channel ban is present" {
echo "{newban #foober *!test@foo.com testuser comment 60 sticky}" |nc localhost 45678
echo "{newchanban #foober *!test@foo.com testuser comment 60 sticky}" |nc localhost 45678
run bash -c 'echo "{isbansticky *!test@foo.com #foober}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "isbansticky #channel returns 1 if global and channel ban is present" {
echo "{newchanban #foober *!test@foo.com testuser comment 60 sticky}" |nc localhost 45678
echo "{newban *!test@foo.com testuser comment 60 sticky}" |nc localhost 45678
run bash -c 'echo "{isbansticky *!test@foo.com}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "isbansticky #channel returns 0 if only global ban is present" {
echo "{killchanban #foober *!test@foo.com}" |nc localhost 45678
echo "{newban *!test@foo.com testuser comment 60 sticky}" |nc localhost 45678
run bash -c 'echo "{isbansticky *!test@foo.com #foober}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "isbansticky returns 0 if only channel ban is present" {
echo "{killban *!test@foo.com}" |nc localhost 45678
echo "{newchanban #foober *!test@foo.com testuser comment 60 sticky}" |nc localhost 45678
run bash -c 'echo "{isban *!test@foo.com}" |nc localhost 45678'
[[ "${output}" == *"0 {0}"* ]]
}
##################
### Check isexempt
##################
@test "isexempt returns 0 if global and channel exempts DNE" {
echo "{killchanexempt #foober *!test@foo.com}" |nc localhost 45678
echo "{killexempt *!test@foo.com}" |nc localhost 45678
run bash -c 'echo "{isexempt *!test@foo.com}" |nc localhost 45678'
[[ "${output}" == *"0 {0}"* ]]
}
@test "isexempt returns 1 if only global exempt is present" {
echo "{killchanexempt #foober *!test@foo.com}" |nc localhost 45678
echo "{newexempt *!test@foo.com testuser comment}" |nc localhost 45678
run bash -c 'echo "{isexempt *!test@foo.com}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "isexempt channel returns 1 if only channel exempt is present" {
echo "{killexempt *!test@foo.com}" |nc localhost 45678
echo "{newchanexempt #foober *!test@foo.com testuser comment}" |nc localhost 45678
run bash -c 'echo "{isexempt *!test@foo.com #foober}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "isexempt returns 1 if global and channel exempt is present" {
echo "{newexempt #foober *!test@foo.com testuser comment}" |nc localhost 45678
echo "{newchanexempt #foober *!test@foo.com testuser comment}" |nc localhost 45678
run bash -c 'echo "{isexempt *!test@foo.com #foober}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "isexempt #channel returns 1 if global and channel exempt is present" {
echo "{newchanexempt #foober *!test@foo.com testuser comment}" |nc localhost 45678
echo "{newexempt *!test@foo.com testuser comment}" |nc localhost 45678
run bash -c 'echo "{isexempt *!test@foo.com}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "isexempt #channel returns 0 if only global exempt is present" {
echo "{killchanexempt #foober *!test@foo.com}" |nc localhost 45678
echo "{newexempt *!test@foo.com testuser comment}" |nc localhost 45678
run bash -c 'echo "{isexempt *!test@foo.com #foober}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "isexempt returns 0 if only channel exempt is present" {
echo "{killexempt *!test@foo.com}" |nc localhost 45678
echo "{newchanexempt foober *!test@foo.com testuser comment}" |nc localhost 45678
run bash -c 'echo "{isexempt *!test@foo.com}" |nc localhost 45678'
[[ "${output}" == *"0 {0}"* ]]
}
##################
### Check isinvite
##################
@test "isinvite returns 0 if global and channel invites DNE" {
echo "{killchaninvite #foober *!test@foo.com}" |nc localhost 45678
echo "{killinvite *!test@foo.com}" |nc localhost 45678
run bash -c 'echo "{isinvite *!test@foo.com}" |nc localhost 45678'
[[ "${output}" == *"0 {0}"* ]]
}
@test "isinvite returns 1 if only global invite is present" {
echo "{killchaninvite #foober *!test@foo.com}" |nc localhost 45678
echo "{newinvite *!test@foo.com testuser comment}" |nc localhost 45678
run bash -c 'echo "{isinvite *!test@foo.com}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "isinvite #channel returns 1 if only channel invite is present" {
echo "{killinvite *!test@foo.com}" |nc localhost 45678
echo "{newchaninvite #foober *!test@foo.com testuser comment}" |nc localhost 45678
run bash -c 'echo "{isinvite *!test@foo.com #foober}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "isinvite returns 1 if global and channel invite is present" {
echo "{newinvite #foober *!test@foo.com testuser comment}" |nc localhost 45678
echo "{newchaninvite #foober *!test@foo.com testuser comment}" |nc localhost 45678
run bash -c 'echo "{isinvite *!test@foo.com #foober}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "isinvite #channel returns 1 if global and channel invite is present" {
echo "{newchaninvite #foober *!test@foo.com testuser comment}" |nc localhost 45678
echo "{newinvite *!test@foo.com testuser comment}" |nc localhost 45678
run bash -c 'echo "{isinvite *!test@foo.com}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "isinvite #channel returns 0 if only global invite is present" {
echo "{killchaninvite #foober *!test@foo.com}" |nc localhost 45678
echo "{newinvite *!test@foo.com testuser comment}" |nc localhost 45678
run bash -c 'echo "{isinvite *!test@foo.com #foober}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "isinvite returns 0 if only channel invite is present" {
echo "{killinvite *!test@foo.com}" |nc localhost 45678
echo "{newchaninvite #foober *!test@foo.com testuser comment}" |nc localhost 45678
run bash -c 'echo "{isinvite *!test@foo.com}" |nc localhost 45678'
[[ "${output}" == *"0 {0}"* ]]
}
@test "Eggdrop dies" {
run bash -c 'reply=$(echo {die} |nc localhost 45678); echo $reply | cut -d "{" -f2 | cut -d "}" -f1'
[ $status -eq 0 ]
}