def test_reset_db(request_ctx): """Test reset_db function for 'testing' cycle reset.""" with request_ctx("/reset_db") as ctx: org = Organisation(name="THE ORGANISATION") org.save() u = User(email="*****@*****.**", name="TEST USER", username="******", roles=Role.SUPERUSER, orcid=None, confirmed=True) u.save() root = User(email="*****@*****.**", name="The root", username="******", roles=Role.SUPERUSER, orcid=None, confirmed=True) root.save() assert User.select().count() == 2 assert Organisation.select().count() == 1 login_user(u, remember=True) rv = ctx.app.full_dispatch_request() assert User.select().count() == 1 assert Organisation.select().count() == 0 assert rv.status_code == 302 assert rv.location == url_for("logout")
def test_org_count(test_models): assert Organisation.select().count() == 10