|
|
|
@ -231,7 +231,7 @@ testing 123` |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
let filterId; |
|
|
|
|
test('add filter post', async () => { |
|
|
|
|
test('add filter to test board', async () => { |
|
|
|
|
const params = new URLSearchParams({ |
|
|
|
|
_csrf: csrfToken, |
|
|
|
|
filters: `notgood
|
|
|
|
@ -252,25 +252,24 @@ bad words`, |
|
|
|
|
redirect: 'manual', |
|
|
|
|
}); |
|
|
|
|
expect(response.ok).toBe(true); |
|
|
|
|
const filterPage = await fetch('http://localhost/test/manage/filter.html', { |
|
|
|
|
const filterPage = await fetch('http://localhost/test/manage/filters.html', { |
|
|
|
|
headers: { |
|
|
|
|
'cookie': sessionCookie, |
|
|
|
|
}, |
|
|
|
|
}).then(res => res.text()); |
|
|
|
|
const checkIndex = filterPage.indexOf('name="checkedfilter" value="'); |
|
|
|
|
filterId = filterPage.substring(checkIndex+28, checkIndex+28+24); |
|
|
|
|
const checkIndex = filterPage.indexOf('name="checkedfilters" value="'); |
|
|
|
|
filterId = filterPage.substring(checkIndex+29, checkIndex+29+24); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('edit filter post', async () => { |
|
|
|
|
test('edit filter on test board', async () => { |
|
|
|
|
const params = new URLSearchParams({ |
|
|
|
|
_csrf: csrfToken, |
|
|
|
|
board: test, |
|
|
|
|
filter_id: filterId, |
|
|
|
|
filters: 'edited filters', |
|
|
|
|
strict_filtering: 'true', |
|
|
|
|
filter_mode: '0', |
|
|
|
|
filter_mode: '1', |
|
|
|
|
filter_message: 'edited message', |
|
|
|
|
filter_ban_duration: '0' |
|
|
|
|
filter_ban_duration: '1s' |
|
|
|
|
// filter_ban_appealable omitted to change to false
|
|
|
|
|
}); |
|
|
|
|
const response = await fetch('http://localhost/forms/board/test/editfilter', { |
|
|
|
@ -283,7 +282,7 @@ bad words`, |
|
|
|
|
redirect: 'manual', |
|
|
|
|
}); |
|
|
|
|
expect(response.ok).toBe(true); |
|
|
|
|
const filterPage = await fetch('http://localhost/test/manage/filter.html', { |
|
|
|
|
const filterPage = await fetch('http://localhost/test/manage/filters.html', { |
|
|
|
|
headers: { |
|
|
|
|
'cookie': sessionCookie, |
|
|
|
|
}, |
|
|
|
@ -292,10 +291,39 @@ bad words`, |
|
|
|
|
expect(editTextIndex).not.toBe(-1); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('delete filter post', async () => { |
|
|
|
|
test('make a post that doesnt hit board filter', async () => { |
|
|
|
|
const params = new URLSearchParams(); |
|
|
|
|
params.append('message', 'blahblahblah'); |
|
|
|
|
params.append('captcha', '000000'); |
|
|
|
|
const response = await fetch('http://localhost/forms/board/test/post', { |
|
|
|
|
headers: { |
|
|
|
|
'x-using-xhr': 'true', |
|
|
|
|
}, |
|
|
|
|
method: 'POST', |
|
|
|
|
body: params |
|
|
|
|
}); |
|
|
|
|
expect(response.ok).toBe(true); |
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('make a post that hits board filter', async () => { |
|
|
|
|
const params = new URLSearchParams(); |
|
|
|
|
params.append('message', 'edited filters'); |
|
|
|
|
params.append('captcha', '000000'); |
|
|
|
|
const response = await fetch('http://localhost/forms/board/test/post', { |
|
|
|
|
headers: { |
|
|
|
|
'x-using-xhr': 'true', |
|
|
|
|
}, |
|
|
|
|
method: 'POST', |
|
|
|
|
body: params |
|
|
|
|
}); |
|
|
|
|
expect(response.ok).not.toBe(true); |
|
|
|
|
await new Promise(res => setTimeout(res, 10000)); //let ban expire
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('delete test board filter', async () => { |
|
|
|
|
const params = new URLSearchParams({ |
|
|
|
|
_csrf: csrfToken, |
|
|
|
|
checkedfilter: filterId, |
|
|
|
|
checkedfilters: filterId, |
|
|
|
|
}); |
|
|
|
|
const response = await fetch('http://localhost/forms/board/test/deletefilter', { |
|
|
|
|
headers: { |
|
|
|
@ -309,6 +337,20 @@ bad words`, |
|
|
|
|
expect(response.ok).toBe(true); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('make a post that passes the deleted filter', async () => { |
|
|
|
|
const params = new URLSearchParams(); |
|
|
|
|
params.append('message', 'editing filter'); |
|
|
|
|
params.append('captcha', '000000'); |
|
|
|
|
const response = await fetch('http://localhost/forms/board/test/post', { |
|
|
|
|
headers: { |
|
|
|
|
'x-using-xhr': 'true', |
|
|
|
|
}, |
|
|
|
|
method: 'POST', |
|
|
|
|
body: params |
|
|
|
|
}); |
|
|
|
|
expect(response.ok).toBe(true); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('add staff', async () => { |
|
|
|
|
const params = new URLSearchParams({ |
|
|
|
|
_csrf: csrfToken, |
|
|
|
|