From f93d24b824ebf26bdb3643d731f847855d0c2bbd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Laur=C3=A9line=20Gu=C3=A9rin?= <zebuline@entrouvert.com>
Date: Fri, 23 Oct 2020 11:15:02 +0200
Subject: [PATCH 3/5] misc: move admin pages tests

---
 tests/admin_pages/__init__.py                                 | 0
 tests/{test_admin_pages.py => admin_pages/test_all.py}        | 4 ++--
 tests/{test_cards_admin_pages.py => admin_pages/test_card.py} | 2 +-
 .../test_datasource.py}                                       | 2 +-
 tests/{test_forms_admin_pages.py => admin_pages/test_form.py} | 2 +-
 .../test_workflow.py}                                         | 2 +-
 .../test_wscall.py}                                           | 2 +-
 tests/backoffice_pages/__init__.py                            | 0
 tests/backoffice_pages/test_custom_view.py                    | 2 +-
 tests/test_snapshots.py                                       | 2 +-
 10 files changed, 9 insertions(+), 9 deletions(-)
 create mode 100644 tests/admin_pages/__init__.py
 rename tests/{test_admin_pages.py => admin_pages/test_all.py} (99%)
 rename tests/{test_cards_admin_pages.py => admin_pages/test_card.py} (99%)
 rename tests/{test_datasources_admin_pages.py => admin_pages/test_datasource.py} (99%)
 rename tests/{test_forms_admin_pages.py => admin_pages/test_form.py} (99%)
 rename tests/{test_workflows_admin_pages.py => admin_pages/test_workflow.py} (99%)
 rename tests/{test_wscalls_admin_pages.py => admin_pages/test_wscall.py} (99%)
 create mode 100644 tests/backoffice_pages/__init__.py

diff --git a/tests/admin_pages/__init__.py b/tests/admin_pages/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/test_admin_pages.py b/tests/admin_pages/test_all.py
similarity index 99%
rename from tests/test_admin_pages.py
rename to tests/admin_pages/test_all.py
index 194c203c..eb61a513 100644
--- a/tests/test_admin_pages.py
+++ b/tests/admin_pages/test_all.py
@@ -1261,7 +1261,7 @@ def test_settings_idp(pub):
     assert resp_metadata.text.startswith('<?xml')
     resp2 = resp.click('Identity Providers')
     resp2 = resp2.click('New')
-    idp_metadata_filename = os.path.join(os.path.dirname(__file__), 'idp_metadata.xml')
+    idp_metadata_filename = os.path.join(os.path.dirname(__file__), '..', 'idp_metadata.xml')
     resp2.form['metadata'] = Upload('idp_metadata.xml', open(idp_metadata_filename, 'rb').read())
     resp2 = resp2.form.submit('submit')
 
@@ -1283,7 +1283,7 @@ def test_settings_idp(pub):
     assert len(pub.cfg['idp']) == 0
 
     with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
-        idp_metadata_filename = os.path.join(os.path.dirname(__file__), 'idp_metadata.xml')
+        idp_metadata_filename = os.path.join(os.path.dirname(__file__), '..', 'idp_metadata.xml')
         urlopen.side_effect = lambda *args: open(idp_metadata_filename, 'rb')
         resp = app.get('/backoffice/settings/identification/idp/idp/')
         resp = resp.click('Create new from remote URL')
diff --git a/tests/test_cards_admin_pages.py b/tests/admin_pages/test_card.py
similarity index 99%
rename from tests/test_cards_admin_pages.py
rename to tests/admin_pages/test_card.py
index 60e1a52b..0e3b98f1 100644
--- a/tests/test_cards_admin_pages.py
+++ b/tests/admin_pages/test_card.py
@@ -14,7 +14,7 @@ from wcs.workflows import WorkflowBackofficeFieldsFormDef
 from wcs.workflows import WorkflowVariablesFieldsFormDef
 
 from utilities import get_app, login, create_temporary_pub, clean_temporary_pub
-from test_admin_pages import create_superuser
+from .test_all import create_superuser
 
 
 def pytest_generate_tests(metafunc):
diff --git a/tests/test_datasources_admin_pages.py b/tests/admin_pages/test_datasource.py
similarity index 99%
rename from tests/test_datasources_admin_pages.py
rename to tests/admin_pages/test_datasource.py
index 58010a34..28c051a1 100644
--- a/tests/test_datasources_admin_pages.py
+++ b/tests/admin_pages/test_datasource.py
@@ -23,7 +23,7 @@ from wcs.carddef import CardDef
 from wcs import fields
 
 from utilities import get_app, login, create_temporary_pub, clean_temporary_pub, HttpRequestsMocking
-from test_admin_pages import create_superuser, create_role
+from .test_all import create_superuser, create_role
 
 
 def pytest_generate_tests(metafunc):
diff --git a/tests/test_forms_admin_pages.py b/tests/admin_pages/test_form.py
similarity index 99%
rename from tests/test_forms_admin_pages.py
rename to tests/admin_pages/test_form.py
index 2497e840..0f0cd2ad 100644
--- a/tests/test_forms_admin_pages.py
+++ b/tests/admin_pages/test_form.py
@@ -24,7 +24,7 @@ from wcs import fields
 
 from utilities import get_app, login, create_temporary_pub, clean_temporary_pub
 
-from test_admin_pages import create_superuser, create_role
+from .test_all import create_superuser, create_role
 
 
 def pytest_generate_tests(metafunc):
diff --git a/tests/test_workflows_admin_pages.py b/tests/admin_pages/test_workflow.py
similarity index 99%
rename from tests/test_workflows_admin_pages.py
rename to tests/admin_pages/test_workflow.py
index d128253c..0eabec0c 100644
--- a/tests/test_workflows_admin_pages.py
+++ b/tests/admin_pages/test_workflow.py
@@ -25,7 +25,7 @@ from wcs.formdef import FormDef
 from wcs import fields
 
 from utilities import get_app, login, create_temporary_pub, clean_temporary_pub
-from test_admin_pages import create_superuser, create_role
+from .test_all import create_superuser, create_role
 
 
 def pytest_generate_tests(metafunc):
diff --git a/tests/test_wscalls_admin_pages.py b/tests/admin_pages/test_wscall.py
similarity index 99%
rename from tests/test_wscalls_admin_pages.py
rename to tests/admin_pages/test_wscall.py
index 1656938a..6c69b14f 100644
--- a/tests/test_wscalls_admin_pages.py
+++ b/tests/admin_pages/test_wscall.py
@@ -11,7 +11,7 @@ from wcs.qommon.http_request import HTTPRequest
 from wcs.wscalls import NamedWsCall
 
 from utilities import get_app, login, create_temporary_pub, clean_temporary_pub
-from test_admin_pages import create_superuser
+from .test_all import create_superuser
 
 
 def pytest_generate_tests(metafunc):
diff --git a/tests/backoffice_pages/__init__.py b/tests/backoffice_pages/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/backoffice_pages/test_custom_view.py b/tests/backoffice_pages/test_custom_view.py
index fbbb61a6..522f893a 100644
--- a/tests/backoffice_pages/test_custom_view.py
+++ b/tests/backoffice_pages/test_custom_view.py
@@ -17,7 +17,7 @@ from wcs.roles import Role
 from wcs import fields
 
 from utilities import (get_app, login, create_temporary_pub, clean_temporary_pub)
-from test_all import create_user, create_superuser
+from .test_all import create_user, create_superuser
 
 
 def pytest_generate_tests(metafunc):
diff --git a/tests/test_snapshots.py b/tests/test_snapshots.py
index 0d0d2aa2..ac812cde 100644
--- a/tests/test_snapshots.py
+++ b/tests/test_snapshots.py
@@ -17,7 +17,7 @@ from wcs.workflows import ExportToModel
 from wcs.wscalls import NamedWsCall
 
 from utilities import get_app, login, create_temporary_pub, clean_temporary_pub
-from test_admin_pages import create_superuser, create_role
+from admin_pages.test_all import create_superuser, create_role
 
 
 @pytest.fixture
-- 
2.28.0

