From 60b61e1ee2fe59cb870efafd27f032adbbae405f Mon Sep 17 00:00:00 2001 From: thomaswoehlke <thomas.woehlke@gmail.com> Date: Sun, 21 Feb 2021 00:08:18 +0100 Subject: [PATCH] working for 0.0.198 Release --- src/covid19/__init__.py | 6 ++--- src/covid19_worker/__init__.py | 7 ------ .../blueprints/admin/test_admin_views.py | 24 ++++++++++++------- .../application/test_application_views.py | 23 ++++++++++++++++++ tests/covid19/blueprints/owid/test_flaskr.py | 24 ------------------- tests/covid19/blueprints/owid/test_owid.py | 15 ++++++++++++ .../covid19/blueprints/who/test_who_views.py | 22 ++++++++--------- 7 files changed, 67 insertions(+), 54 deletions(-) create mode 100644 tests/covid19/blueprints/application/test_application_views.py delete mode 100644 tests/covid19/blueprints/owid/test_flaskr.py create mode 100644 tests/covid19/blueprints/owid/test_owid.py diff --git a/src/covid19/__init__.py b/src/covid19/__init__.py index 546f6be3..a2b7f314 100644 --- a/src/covid19/__init__.py +++ b/src/covid19/__init__.py @@ -9,7 +9,5 @@ def run_web(): app.logger.info("# Covid19 Data - WEB #") app.logger.info("#############################################################") app.logger.info(" ") - app.run( - debug=run_run_with_debug, - port=port - ) + app.run(debug=run_run_with_debug, port=port) + diff --git a/src/covid19_worker/__init__.py b/src/covid19_worker/__init__.py index 142e368e..e69de29b 100644 --- a/src/covid19_worker/__init__.py +++ b/src/covid19_worker/__init__.py @@ -1,7 +0,0 @@ -import sys -import subprocess -from covid19 import app -from covid19.blueprints.application.application_workers import celery - - - diff --git a/tests/covid19/blueprints/admin/test_admin_views.py b/tests/covid19/blueprints/admin/test_admin_views.py index 5006fe04..c5620817 100644 --- a/tests/covid19/blueprints/admin/test_admin_views.py +++ b/tests/covid19/blueprints/admin/test_admin_views.py @@ -1,15 +1,23 @@ -#from flask import render_template, redirect, url_for, flash, Blueprint -#from celery import states -#from celery.utils.log import get_task_logger import pytest from flask import url_for -import tests.conftest +from unittest import TestCase +from conftest import app, client -def test_url_admin_tasks(client): - assert client.get(url_for('admin.url_admin_tasks')).status_code == 200 +class Test(TestCase): + def __init__(self, client): + self.client = client + self.url_admin_tasks = url_for('admin.url_admin_tasks', _external=True) + self.url_admin_info = url_for('admin.url_admin_info', _external=True) + def test_run_test_01(self): + self.assertTrue(True) -def test_url_admin_info(client): - assert client.get(url_for('admin.url_admin_info')).status_code == 200 + def test_run_test_02(self): + self.assertTrue(True) + def test_url_admin_tasks(self): + assert self.client.get(self.url_admin_tasks).status_code == 200 + + def test_url_admin_info(self): + assert self.client.get(self.url_admin_info).status_code == 200 diff --git a/tests/covid19/blueprints/application/test_application_views.py b/tests/covid19/blueprints/application/test_application_views.py new file mode 100644 index 00000000..ce8a5870 --- /dev/null +++ b/tests/covid19/blueprints/application/test_application_views.py @@ -0,0 +1,23 @@ +import pytest +from flask import url_for +from unittest import TestCase +from conftest import app, client + + +class Test(TestCase): + def __init__(self, client): + self.client = client + self.url_home = url_for('application.url_home', _external=True) + self.url_root = url_for('application.url_root', _external=True) + + def test_run_test_01(self): + self.assertTrue(True) + + def test_run_test_02(self): + self.assertTrue(True) + + def test_url_home(self): + assert self.client.get(self.url_home).status_code == 200 + + def test_url_root(self): + assert self.client.get(self.url_root).status_code == 200 diff --git a/tests/covid19/blueprints/owid/test_flaskr.py b/tests/covid19/blueprints/owid/test_flaskr.py deleted file mode 100644 index 907a5bd0..00000000 --- a/tests/covid19/blueprints/owid/test_flaskr.py +++ /dev/null @@ -1,24 +0,0 @@ -import logging - -#from src.covid19.blueprints.application.application_services import owid_service -#from src.covid19.blueprints.application.application_workers import celery -#from src.covid19.blueprints.owid.owid_model import OwidDateReported, OwidData -#from src.covid19.blueprints.owid.owid_model_import import OwidImport -#from src.covid19.blueprints.application.application_model_transient import ApplicationPage - -from unittest import TestCase -#from tests.conftest import app - - -class Test(TestCase): - #def test_run_test(self): - # continents = OwidImport.get_continents() - # for continent in continents: - # logging.info(continent) - # self.assertTrue(True) - - def test_run_test_01(self): - self.assertTrue(True) - - def test_run_test_02(self): - self.assertTrue(True) diff --git a/tests/covid19/blueprints/owid/test_owid.py b/tests/covid19/blueprints/owid/test_owid.py new file mode 100644 index 00000000..fa423d5f --- /dev/null +++ b/tests/covid19/blueprints/owid/test_owid.py @@ -0,0 +1,15 @@ +import pytest +from flask import url_for +from unittest import TestCase +from conftest import app, client + + +class Test(TestCase): + def __init__(self, client): + self.client = client + + def test_run_test_01(self): + self.assertTrue(True) + + def test_run_test_02(self): + self.assertTrue(True) diff --git a/tests/covid19/blueprints/who/test_who_views.py b/tests/covid19/blueprints/who/test_who_views.py index 2b898433..5a335ce9 100644 --- a/tests/covid19/blueprints/who/test_who_views.py +++ b/tests/covid19/blueprints/who/test_who_views.py @@ -1,17 +1,17 @@ import pytest from flask import url_for -import covid19.blueprints.application.application_views -import tests.conftest +from unittest import TestCase +from conftest import app, client -appctx = None -reqctx = None +class Test(TestCase): + def __init__(self, client): + self.client = client + self.url_admin_tasks = url_for(endpoint='who.url_who_info', _external=True) + self.url_admin_info = url_for(endpoint='who.url_who_info', _external=True) -def test_url_admin_tasks(client): - url = url_for(endpoint='who.url_who_info', _external=True, appctx=appctx, reqctx=reqctx) - assert client.get(url).status_code == 200 + def test_url_admin_tasks(self): + assert self.client.get(self.url_admin_tasks).status_code == 200 - -def test_url_admin_info(client): - url = url_for(endpoint='who.url_who_info', _external=True, appctx=appctx, reqctx=reqctx) - assert client.get(url).status_code == 200 + def test_url_admin_info(self): + assert self.client.get(self.url_admin_info).status_code == 200 -- GitLab