From 5abec585e7712ae54b51d176423fc160e2a401e3 Mon Sep 17 00:00:00 2001 From: Mia Wang <yw21218@ic.ac.uk> Date: Tue, 26 Apr 2022 11:28:42 +0100 Subject: [PATCH] adding pytest for react --- flask_mvp/auto_augmentation/__init__.py | 7 ++++--- test/web_app/test_react_user_input.py | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 test/web_app/test_react_user_input.py diff --git a/flask_mvp/auto_augmentation/__init__.py b/flask_mvp/auto_augmentation/__init__.py index 72634111..cd76980e 100644 --- a/flask_mvp/auto_augmentation/__init__.py +++ b/flask_mvp/auto_augmentation/__init__.py @@ -2,8 +2,9 @@ import os from flask import Flask, render_template, request, flash -from auto_augmentation import home, progress,result -from flask_mvp.auto_augmentation import training +from . import home, progress,result +from . import training + def create_app(test_config=None): # create and configure the app @@ -22,7 +23,7 @@ def create_app(test_config=None): # ensure the instance folder exists os.makedirs(app.instance_path, exist_ok=True) - from auto_augmentation import download_file + from . import download_file app.register_blueprint(home.bp) app.register_blueprint(progress.bp) diff --git a/test/web_app/test_react_user_input.py b/test/web_app/test_react_user_input.py new file mode 100644 index 00000000..1f6ac8e9 --- /dev/null +++ b/test/web_app/test_react_user_input.py @@ -0,0 +1,17 @@ +import pytest +import unittest +import os +import sys +from backend_react import react_app + + + +class MyTestCase(unittest.TestCase): + + def setUp(self): + react_app.app.testing = True + self.app = react_app.app.test_client() + + def test_home(self): + result = self.app.get('/') + # Make your assertions \ No newline at end of file -- GitLab