@@ -10,9 +10,9 @@ describe('Client', () => {
10
10
const host = new Host ( 'http://10.0.0.2' , 'mypassword' ) ;
11
11
12
12
const createClient = async ( ) => {
13
- nock ( host . fullUrl ) . get ( '/admin/ index.php?login' ) . reply ( 200 ) ;
13
+ nock ( host . fullUrl ) . get ( '/index.php?login' ) . reply ( 200 ) ;
14
14
nock ( host . fullUrl )
15
- . post ( '/admin/ index.php?login' )
15
+ . post ( '/index.php?login' )
16
16
. reply (
17
17
200 ,
18
18
'<html><body><div id="token">abcdefgijklmnopqrstuvwxyzabcdefgijklmnopqrst</div></body></html>'
@@ -27,8 +27,8 @@ describe('Client', () => {
27
27
28
28
describe ( 'create' , ( ) => {
29
29
test ( 'should throw error if status code is not ok' , async ( ) => {
30
- const initialRequest = nock ( host . fullUrl ) . get ( '/admin/ index.php?login' ) . reply ( 200 ) ;
31
- const loginRequest = nock ( host . fullUrl ) . post ( '/admin/ index.php?login' ) . reply ( 500 ) ;
30
+ const initialRequest = nock ( host . fullUrl ) . get ( '/index.php?login' ) . reply ( 200 ) ;
31
+ const loginRequest = nock ( host . fullUrl ) . post ( '/index.php?login' ) . reply ( 500 ) ;
32
32
33
33
const expectError = expect ( Client . create ( host ) ) . rejects ;
34
34
@@ -47,8 +47,8 @@ describe('Client', () => {
47
47
} ) ;
48
48
49
49
test ( 'should throw error if no token is present' , async ( ) => {
50
- const initialRequest = nock ( host . fullUrl ) . get ( '/admin/ index.php?login' ) . reply ( 200 ) ;
51
- const loginRequest = nock ( host . fullUrl ) . post ( '/admin/ index.php?login' ) . reply ( 200 ) ;
50
+ const initialRequest = nock ( host . fullUrl ) . get ( '/index.php?login' ) . reply ( 200 ) ;
51
+ const loginRequest = nock ( host . fullUrl ) . post ( '/index.php?login' ) . reply ( 200 ) ;
52
52
53
53
const expectError = expect ( Client . create ( host ) ) . rejects ;
54
54
@@ -66,9 +66,9 @@ describe('Client', () => {
66
66
} ) ;
67
67
68
68
test ( 'should throw error if token is in incorrect format' , async ( ) => {
69
- const initialRequest = nock ( host . fullUrl ) . get ( '/admin/ index.php?login' ) . reply ( 200 ) ;
69
+ const initialRequest = nock ( host . fullUrl ) . get ( '/index.php?login' ) . reply ( 200 ) ;
70
70
const loginRequest = nock ( host . fullUrl )
71
- . post ( '/admin/ index.php?login' )
71
+ . post ( '/index.php?login' )
72
72
. reply ( 200 , '<html><body><div id="token">abcdef</div></body></html>' ) ;
73
73
74
74
const expectError = expect ( Client . create ( host ) ) . rejects ;
@@ -87,9 +87,9 @@ describe('Client', () => {
87
87
} ) ;
88
88
89
89
test ( 'should return client' , async ( ) => {
90
- const initialRequest = nock ( host . fullUrl ) . get ( '/admin/ index.php?login' ) . reply ( 200 ) ;
90
+ const initialRequest = nock ( host . fullUrl ) . get ( '/index.php?login' ) . reply ( 200 ) ;
91
91
const loginRequest = nock ( host . fullUrl )
92
- . post ( '/admin/ index.php?login' )
92
+ . post ( '/index.php?login' )
93
93
. reply (
94
94
200 ,
95
95
'<html><body><div id="token">abcdefgijklmnopqrstuvwxyzabcdefgijklmnopqrst</div></body></html>'
@@ -115,7 +115,7 @@ describe('Client', () => {
115
115
} ) ;
116
116
117
117
test ( 'should throw error if response is non-200' , async ( ) => {
118
- teleporter . post ( '/admin/ scripts/pi-hole/php/teleporter.php' ) . reply ( 500 ) ;
118
+ teleporter . post ( '/scripts/pi-hole/php/teleporter.php' ) . reply ( 500 ) ;
119
119
120
120
const expectError = expect ( client . downloadBackup ( ) ) . rejects ;
121
121
@@ -132,7 +132,7 @@ describe('Client', () => {
132
132
133
133
test ( 'should throw error if content type is not gzip' , async ( ) => {
134
134
teleporter
135
- . post ( '/admin/ scripts/pi-hole/php/teleporter.php' )
135
+ . post ( '/scripts/pi-hole/php/teleporter.php' )
136
136
. reply ( 200 , undefined , { 'content-type' : 'text/html' } ) ;
137
137
138
138
const expectError = expect ( client . downloadBackup ( ) ) . rejects ;
@@ -153,7 +153,7 @@ describe('Client', () => {
153
153
154
154
let requestBody = '' ;
155
155
teleporter
156
- . post ( '/admin/ scripts/pi-hole/php/teleporter.php' , ( body ) => ( requestBody = body ) )
156
+ . post ( '/scripts/pi-hole/php/teleporter.php' , ( body ) => ( requestBody = body ) )
157
157
. reply ( 200 , undefined , { 'content-type' : 'application/gzip' } ) ;
158
158
159
159
const backup = await client . downloadBackup ( ) ;
@@ -197,7 +197,7 @@ describe('Client', () => {
197
197
} ) ;
198
198
199
199
test ( 'should throw error if response is non-200' , async ( ) => {
200
- teleporter . post ( '/admin/ scripts/pi-hole/php/teleporter.php' ) . reply ( 500 ) ;
200
+ teleporter . post ( '/scripts/pi-hole/php/teleporter.php' ) . reply ( 500 ) ;
201
201
202
202
const expectError = expect ( client . uploadBackup ( backup ) ) . rejects ;
203
203
@@ -213,7 +213,7 @@ describe('Client', () => {
213
213
} ) ;
214
214
215
215
test ( 'should throw error if response does not end with "OK"' , async ( ) => {
216
- teleporter . post ( '/admin/ scripts/pi-hole/php/teleporter.php' ) . reply ( 200 ) ;
216
+ teleporter . post ( '/scripts/pi-hole/php/teleporter.php' ) . reply ( 200 ) ;
217
217
218
218
const expectError = expect ( client . uploadBackup ( backup ) ) . rejects ;
219
219
@@ -230,7 +230,7 @@ describe('Client', () => {
230
230
231
231
test ( 'should throw error if gravity update fails' , async ( ) => {
232
232
teleporter
233
- . post ( '/admin/ scripts/pi-hole/php/teleporter.php' )
233
+ . post ( '/scripts/pi-hole/php/teleporter.php' )
234
234
. reply (
235
235
200 ,
236
236
'Processed adlist (14 entries)<br>\n' +
@@ -248,7 +248,7 @@ describe('Client', () => {
248
248
'OK'
249
249
) ;
250
250
teleporter
251
- . get ( '/admin/ scripts/pi-hole/php/gravity.sh.php' , undefined )
251
+ . get ( '/scripts/pi-hole/php/gravity.sh.php' , undefined )
252
252
. reply ( 200 , '\ndata: \n\ndata: [✓] TCP (IPv6)\ndata: \ndata: \n\ndata:' ) ;
253
253
254
254
const expectError = expect ( client . uploadBackup ( backup ) ) . rejects ;
@@ -269,7 +269,7 @@ describe('Client', () => {
269
269
270
270
let requestBody = '' ;
271
271
teleporter
272
- . post ( '/admin/ scripts/pi-hole/php/teleporter.php' , ( body ) => ( requestBody = body ) )
272
+ . post ( '/scripts/pi-hole/php/teleporter.php' , ( body ) => ( requestBody = body ) )
273
273
. reply (
274
274
200 ,
275
275
'Processed adlist (14 entries)<br>\n' +
@@ -287,7 +287,7 @@ describe('Client', () => {
287
287
'OK'
288
288
) ;
289
289
teleporter
290
- . get ( '/admin/ scripts/pi-hole/php/gravity.sh.php' , undefined )
290
+ . get ( '/scripts/pi-hole/php/gravity.sh.php' , undefined )
291
291
. reply (
292
292
200 ,
293
293
'\ndata: \n\ndata: [✓] TCP (IPv6)\ndata: \ndata: \n\ndata: [✓] Pi-hole blocking is enabled\ndata: \n\ndata:'
@@ -329,7 +329,7 @@ describe('Client', () => {
329
329
330
330
let requestBody = '' ;
331
331
teleporter
332
- . post ( '/admin/ scripts/pi-hole/php/teleporter.php' , ( body ) => ( requestBody = body ) )
332
+ . post ( '/scripts/pi-hole/php/teleporter.php' , ( body ) => ( requestBody = body ) )
333
333
. reply (
334
334
200 ,
335
335
'Processed adlist (14 entries)<br>\n' +
0 commit comments