Fix tests 6
This commit is contained in:
parent
052a219dcc
commit
fb6b8e36ed
|
@ -795,7 +795,9 @@ class MinetestRelease(db.Model):
|
|||
return release
|
||||
|
||||
if protocol_num:
|
||||
return MinetestRelease.query.filter_by(protocol=protocol_num).first()
|
||||
# Find the closest matching release
|
||||
return MinetestRelease.query.order_by(db.desc(MinetestRelease.protocol)) \
|
||||
.filter(MinetestRelease.protocol <= protocol_num).first()
|
||||
|
||||
return None
|
||||
|
||||
|
|
|
@ -74,14 +74,15 @@ def test_packages_with_protocol_high(client):
|
|||
populate_test_data(db.session)
|
||||
db.session.commit()
|
||||
|
||||
rv = client.get("/api/packages/?protocol_version=40")
|
||||
rv = client.get("/api/packages/?protocol_version=100")
|
||||
|
||||
packages = parse_json(rv.data)
|
||||
|
||||
assert len(packages) == 4
|
||||
|
||||
for package in packages:
|
||||
assert package["name"] != "mesecons"
|
||||
assert package["name"] != "handholds"
|
||||
|
||||
assert len(packages) == 4
|
||||
|
||||
validate_package_list(packages, True)
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ def test_homepage_empty(client):
|
|||
"""Start with a blank database."""
|
||||
|
||||
rv = client.get("/")
|
||||
assert b"No packages available" in rv.data and b"packagetile" not in rv.data
|
||||
assert b"No packages available" in rv.data and b"packagegridscrub" not in rv.data
|
||||
|
||||
|
||||
def test_homepage_with_contents(client):
|
||||
|
@ -18,4 +18,4 @@ def test_homepage_with_contents(client):
|
|||
|
||||
rv = client.get("/")
|
||||
|
||||
assert b"No packages available" not in rv.data and b"packagetile" in rv.data
|
||||
assert b"packagegridscrub" in rv.data
|
||||
|
|
Loading…
Reference in New Issue