basic readme

This commit is contained in:
Robin Appelman 2020-11-29 22:14:50 +01:00
commit 50c3e24fe5
3 changed files with 20 additions and 3 deletions

3
.env
View file

@ -1,2 +1,3 @@
DB_URL=postgres://postgres:test@localhost:15432/postgres
BASE_URL=http://localhost:8888
BASE_URL=http://localhost:8888
EDIT_KEY=edit

13
README.md Normal file
View file

@ -0,0 +1,13 @@
# api-test
Test suite for demos.tf api
## Usage
Start the test with the following environment variables
- `DB_URL` - [sqlx](https://github.com/launchbadge/sqlx) database url for the database used by the api
- `BASE_URL` - base url for the api
- `EDIT_KEY` - edit key for the api
Note that the test suite is destructive, all data saved in the database will be wiped for each test run.

View file

@ -28,6 +28,9 @@ async fn main() -> Result<()> {
let coalplant_data = include_bytes!("../data/coalplant.dem");
let ultiduo_data = include_bytes!("../data/ultiduo.dem");
let edit_key = dotenv::var("EDIT_KEY")?;
let edit_key = &edit_key;
Test::run(
"Upload with invalid credentials",
&harness,
@ -374,7 +377,7 @@ async fn main() -> Result<()> {
"somedemo.dem",
"https://example.com/somedemo.dem",
hash,
"edit",
edit_key,
)
.await?;
@ -430,7 +433,7 @@ async fn main() -> Result<()> {
"somedemo.dem",
"https://invalid.com/somedemo.dem",
[1; 16],
"edit",
edit_key,
)
.await;