Closed BlobbyBob closed 3 weeks ago
Correction: The tests are slow because the client
fixture completely restores the database on every test. Maybe there is a nice solution for that.
Nice, tests running in 3s now on my machine
Wondering why I can't link 1.7.2 here so this get's auto closed after merge, mhh. Can you select it @BlobbyBob?
No, it's also disabled for me
Strange
A stack overflow post hints, that you might not be able to link more than 10 issues to a PR. And indeed, v1.7.2 has currently 10 linked issues
Strange decision of the GitHub team, but good to know.
The current server testing setup has some disadvantages:
pg_restore
)I tried to realize some quick improvements over in my fork, but I think it would be better to make a larger restructure:
pg_restore
and instead write a setup script which adds all entities and their relations to a clean database which was set up using all latest migrations. Then you only need to exchange theSQLALCHEMY_DATABASE_URI
to switch to the test setup. (fixes 1, 3, 4, 5)every single
test in my opinion. I would suggest test cases similar to this pseudo code (fixes 2 probably):def test(): line_data = { ... } rv = client.post("/api/lines", json=line_data, auth=get_token("moderator")) assert rv.status_code == 42 line = Line.find_by_slug(line_data["slug"]) assert line is not None # ... and some properties
def test2(): rv = client.post("/api/archive", json={"line":"some-line"}, auth=get_token("moderator")) assert rv.status_code == 42 line = Line.find_by_slug("some-line") assert line.archived == True