pull/16/head
Aevann1 2022-11-26 03:39:53 +02:00
parent e96274308a
commit 9fe0bcfc58
3 changed files with 0 additions and 39 deletions

1
.gitignore vendored
View File

@ -4,7 +4,6 @@ unsanitized.mp4
cache/
__pycache__/
.idea/
**/.pytest_cache/
venv/
.vscode/
.sass-cache/

View File

@ -1,37 +0,0 @@
from bs4 import BeautifulSoup
from time import time, sleep
from files.__main__ import app
# these tests require `docker-compose up` first
def test_rules():
response = app.test_client().get("/sidebar")
assert response.status_code == 200
assert response.text.startswith("<!DOCTYPE html>")
def test_signup():
client = app.test_client()
with client: # this keeps the session between requests, which we need
signup_get_response = client.get("/signup")
assert signup_get_response.status_code == 200
soup = BeautifulSoup(signup_get_response.text, 'html.parser')
# these hidden input values seem to be used for anti-bot purposes and need to be submitted
formkey = next(tag for tag in soup.find_all("input") if tag.get("name") == "formkey").get("value")
form_timestamp = next(tag for tag in soup.find_all("input") if tag.get("name") == "now").get("value")
sleep(5) # too-fast submissions are rejected (bot check?)
username = "testuser" + str(round(time()))
signup_post_response = client.post("/signup", data={
"username": username,
"password": "password",
"password_confirm": "password",
"email": "",
"formkey": formkey,
"now": form_timestamp
})
print(f"Signing up as {username}", flush=True)
assert signup_post_response.status_code == 302
assert "error" not in signup_post_response.location
# we should now be logged in and able to post

View File

@ -28,7 +28,6 @@ tldextract
user-agents
psycopg2-binary
pusher_push_notifications
pytest
youtube-dl
yattag
webptools