Compare commits
1 Commits
feat_testi
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7de359b34 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -214,7 +214,4 @@ __marimo__/
|
|||||||
|
|
||||||
# Streamlit
|
# Streamlit
|
||||||
.streamlit/secrets.toml
|
.streamlit/secrets.toml
|
||||||
|
|
||||||
|
|
||||||
slopserver/server_config.env
|
slopserver/server_config.env
|
||||||
test_db.sqlite
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ starlette==0.48.0
|
|||||||
typer==0.19.2
|
typer==0.19.2
|
||||||
typing-inspection==0.4.2
|
typing-inspection==0.4.2
|
||||||
typing_extensions==4.15.0
|
typing_extensions==4.15.0
|
||||||
urllib3==2.5.0
|
urllib3==2.6.3
|
||||||
uvicorn==0.37.0
|
uvicorn==0.37.0
|
||||||
uvloop==0.22.1
|
uvloop==0.22.1
|
||||||
watchfiles==1.1.1
|
watchfiles==1.1.1
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from pydantic_settings import BaseSettings
|
|||||||
|
|
||||||
|
|
||||||
class ServerSettings(BaseSettings):
|
class ServerSettings(BaseSettings):
|
||||||
db_url: str = "sqlite+pysqlite:///slopserver/test/test_db.sqlite"
|
db_url: str = "sqlite+pysqlite:///test_db.sqlite"
|
||||||
token_secret: str = "5bcc778a96b090c3ac1d587bb694a060eaf7bdb5832365f91d5078faf1fff210"
|
token_secret: str = "5bcc778a96b090c3ac1d587bb694a060eaf7bdb5832365f91d5078faf1fff210"
|
||||||
altcha_secret: str = "0460de065912d0292df1e7422a5ed2dc362ed56d6bab64fe50b89957463061f3"
|
altcha_secret: str = "0460de065912d0292df1e7422a5ed2dc362ed56d6bab64fe50b89957463061f3"
|
||||||
resend_token: str = "re_NXpjzbqR_KgAbu72PKjYHcquX24WvnN3i"
|
resend_token: str = "re_NXpjzbqR_KgAbu72PKjYHcquX24WvnN3i"
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
test_dir=slopserver/test
|
|
||||||
|
|
||||||
sqlite3 $test_dir/test_db.sqlite .dump > $1
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
test_dir=slopserver/test
|
|
||||||
|
|
||||||
cat $test_dir/test_db.sql | sqlite3 $test_dir/test_db.sqlite
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
from fastapi import FastAPI
|
|
||||||
from fastapi.testclient import TestClient
|
|
||||||
from slopserver.server import app as slopserver_app
|
|
||||||
|
|
||||||
client = TestClient(slopserver_app)
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
from slopserver.db import *
|
|
||||||
from slopserver.models import *
|
|
||||||
from slopserver.settings import settings
|
|
||||||
from sqlalchemy import create_engine
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
class TestDBFuncs(unittest.TestCase):
|
|
||||||
|
|
||||||
test_db_url = settings.db_url
|
|
||||||
engine = None
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
engine = create_engine(self.test_db_url)
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
PRAGMA foreign_keys=OFF;
|
|
||||||
BEGIN TRANSACTION;
|
|
||||||
CREATE TABLE domain (
|
|
||||||
id INTEGER NOT NULL,
|
|
||||||
domain_name VARCHAR NOT NULL,
|
|
||||||
CONSTRAINT pk_domain PRIMARY KEY (id)
|
|
||||||
);
|
|
||||||
INSERT INTO domain VALUES(1,'google.com');
|
|
||||||
INSERT INTO domain VALUES(2,'moogle.com');
|
|
||||||
CREATE TABLE user (
|
|
||||||
id INTEGER NOT NULL,
|
|
||||||
email VARCHAR NOT NULL,
|
|
||||||
password_hash VARCHAR NOT NULL,
|
|
||||||
email_verified BOOLEAN NOT NULL,
|
|
||||||
CONSTRAINT pk_user PRIMARY KEY (id)
|
|
||||||
);
|
|
||||||
INSERT INTO user VALUES(1,'alphauser01','$argon2id$v=19$m=65536,t=3,p=4$3z7uxa3NHl/dKG07RGEvBA$0NOBftJpP+HiR7wfgdwBk2UR9F12YBjrqeqLSyDl47o','True');
|
|
||||||
CREATE TABLE path (
|
|
||||||
id INTEGER NOT NULL,
|
|
||||||
path VARCHAR NOT NULL,
|
|
||||||
domain_id INTEGER,
|
|
||||||
CONSTRAINT pk_path PRIMARY KEY (id),
|
|
||||||
CONSTRAINT fk_path_domain_id_domain FOREIGN KEY(domain_id) REFERENCES domain (id)
|
|
||||||
);
|
|
||||||
INSERT INTO path VALUES(1,'/',0);
|
|
||||||
INSERT INTO path VALUES(2,'/path1',0);
|
|
||||||
INSERT INTO path VALUES(3,'/path2',1);
|
|
||||||
INSERT INTO path VALUES(4,'/path3/a',1);
|
|
||||||
INSERT INTO path VALUES(5,'/path4',1);
|
|
||||||
INSERT INTO path VALUES(6,'/path2',2);
|
|
||||||
INSERT INTO path VALUES(7,'/',2);
|
|
||||||
INSERT INTO path VALUES(8,'/path3',2);
|
|
||||||
INSERT INTO path VALUES(9,'/path4',2);
|
|
||||||
CREATE TABLE report (
|
|
||||||
path_id INTEGER NOT NULL,
|
|
||||||
user_id INTEGER NOT NULL,
|
|
||||||
timestamp DATETIME,
|
|
||||||
CONSTRAINT pk_report PRIMARY KEY (path_id, user_id),
|
|
||||||
CONSTRAINT fk_report_path_id_path FOREIGN KEY(path_id) REFERENCES path (id),
|
|
||||||
CONSTRAINT fk_report_user_id_user FOREIGN KEY(user_id) REFERENCES user (id)
|
|
||||||
);
|
|
||||||
INSERT INTO report VALUES(2,1,'11-26-2025');
|
|
||||||
CREATE UNIQUE INDEX ix_domain_domain_name ON domain (domain_name);
|
|
||||||
CREATE UNIQUE INDEX ix_user_email ON user (email);
|
|
||||||
COMMIT;
|
|
||||||
Reference in New Issue
Block a user