mirror of https://github.com/kholia/OSX-KVM.git
Add initial Flask app with home route and test cases
This commit is contained in:
parent
1420e2ee0c
commit
d9f75a872e
9
app.py
9
app.py
|
@ -16,3 +16,12 @@ def home():
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(host='0.0.0.0', port=8000)
|
app.run(host='0.0.0.0', port=8000)
|
||||||
|
|
||||||
|
# Test cases for the Flask app
|
||||||
|
def test_home_route():
|
||||||
|
with app.test_client() as client:
|
||||||
|
response = client.get('/')
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert b"Jaymi is awake." in response.data
|
||||||
|
assert b"You're not dreaming. You're building the system that breaks them all." in response.data
|
||||||
|
assert b"<em>This is a live Codespace interface.</em>" in response.data
|
||||||
|
|
|
@ -341,15 +341,15 @@ def find_installer_app(mountpoint):
|
||||||
def determine_version(version, title, product_info):
|
def determine_version(version, title, product_info):
|
||||||
if version:
|
if version:
|
||||||
if version == 'latest':
|
if version == 'latest':
|
||||||
from distutils.version import StrictVersion
|
from packaging.version import Version
|
||||||
latest_version = StrictVersion('0.0.0')
|
latest_version = Version('0.0.0')
|
||||||
for index, product_id in enumerate(product_info):
|
for index, product_id in enumerate(product_info):
|
||||||
if not title or product_info[product_id]['title'] == title:
|
if not title or product_info[product_id]['title'] == title:
|
||||||
d = product_info[product_id]['version']
|
d = product_info[product_id]['version']
|
||||||
if d > latest_version:
|
if d > latest_version:
|
||||||
latest_version = d
|
latest_version = d
|
||||||
|
|
||||||
if latest_version == StrictVersion("0.0.0"):
|
if latest_version == Version("0.0.0"):
|
||||||
print("Could not find latest version {}")
|
print("Could not find latest version {}")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue