From 0b392866ead883f64fbbcb46e10b965112a8b4b2 Mon Sep 17 00:00:00 2001
From: Mia Wang <yw21218@ic.ac.uk>
Date: Tue, 26 Apr 2022 12:25:52 +0100
Subject: [PATCH] add test for webapp

---
 backend_react/react_app.py                             |  4 ----
 temp_util/parse_ds_cn_arch.py                          |  4 ++--
 .../{test_react_user_input.py => test_flask_routes.py} | 10 ++++++----
 3 files changed, 8 insertions(+), 10 deletions(-)
 rename test/web_app/{test_react_user_input.py => test_flask_routes.py} (64%)

diff --git a/backend_react/react_app.py b/backend_react/react_app.py
index 96da6947..dea4b617 100644
--- a/backend_react/react_app.py
+++ b/backend_react/react_app.py
@@ -161,10 +161,6 @@ def show_result():
 
 
 
-@app.route('/api')
-def index():
-    return {'status': 'api test'}
-
 
 if __name__ == '__main__':
     app.run(debug=False, use_reloader=False)
\ No newline at end of file
diff --git a/temp_util/parse_ds_cn_arch.py b/temp_util/parse_ds_cn_arch.py
index 76d33c19..b8a5f7d5 100644
--- a/temp_util/parse_ds_cn_arch.py
+++ b/temp_util/parse_ds_cn_arch.py
@@ -1,5 +1,5 @@
-from ..MetaAugment.child_networks import *
-from ..MetaAugment.main import create_toy, train_child_network
+from MetaAugment.child_networks import *
+from MetaAugment.main import create_toy, train_child_network
 import torch
 import torchvision
 import torchvision.datasets as datasets
diff --git a/test/web_app/test_react_user_input.py b/test/web_app/test_flask_routes.py
similarity index 64%
rename from test/web_app/test_react_user_input.py
rename to test/web_app/test_flask_routes.py
index 1f6ac8e9..f3dac791 100644
--- a/test/web_app/test_react_user_input.py
+++ b/test/web_app/test_flask_routes.py
@@ -1,8 +1,7 @@
 import pytest
 import unittest
-import os
-import sys
 from backend_react import react_app
+import json
 
 
 
@@ -13,5 +12,8 @@ class MyTestCase(unittest.TestCase):
         self.app = react_app.app.test_client()
 
     def test_home(self):
-        result = self.app.get('/')
-        # Make your assertions
\ No newline at end of file
+        response = self.app.get('/home')
+
+    def test_training(self):
+        response = self.app.get('/training')
+    
-- 
GitLab