2021-02-27 17:45:49 +03:00
|
|
|
import unittest
|
2021-10-01 02:32:18 +03:00
|
|
|
import json
|
2021-02-27 17:45:49 +03:00
|
|
|
|
|
|
|
# Runtime import to avoid syntax errors in samples on Python < 3.5 and reach top-dir
|
|
|
|
import os
|
|
|
|
_TOP_DIR = os.path.abspath(
|
|
|
|
os.path.sep.join((
|
|
|
|
os.path.dirname(__file__),
|
2021-10-01 02:32:18 +03:00
|
|
|
"../",
|
2021-02-27 17:45:49 +03:00
|
|
|
)),
|
|
|
|
)
|
|
|
|
_SAMPLES_DIR = os.path.abspath(
|
|
|
|
os.path.sep.join((
|
|
|
|
os.path.dirname(__file__),
|
2021-10-01 02:32:18 +03:00
|
|
|
"../samples/",
|
2021-02-27 17:45:49 +03:00
|
|
|
)),
|
|
|
|
)
|
|
|
|
import sys
|
|
|
|
sys.path.append(_TOP_DIR)
|
|
|
|
sys.path.append(_SAMPLES_DIR)
|
|
|
|
|
|
|
|
from wiringflask import web
|
|
|
|
|
|
|
|
|
|
|
|
class WiringFlaskTest(unittest.TestCase):
|
|
|
|
|
|
|
|
def test(self):
|
|
|
|
client = web.app.test_client()
|
|
|
|
|
|
|
|
with web.app.app_context():
|
2021-10-01 02:32:18 +03:00
|
|
|
response = client.get("/")
|
2021-02-27 17:45:49 +03:00
|
|
|
|
|
|
|
self.assertEqual(response.status_code, 200)
|
2021-10-01 02:32:18 +03:00
|
|
|
self.assertEqual(json.loads(response.data), {"result": "Ok"})
|