Skip to content

Commit

Permalink
update dataverses, datafiles and datasets unit testing with utils
Browse files Browse the repository at this point in the history
  • Loading branch information
skasberger committed May 17, 2021
1 parent 725d20d commit cafd428
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"all-datafiles": {
"sidebar": {
"facet-not-logged-in": {
"input-expected": [
[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"all-datasets": {
"sidebar": {
"facet-not-logged-in": {
"input-expected": [
[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"all-dataverses": {
"sidebar": {
"facet-not-logged-in": {
"input-expected": [
[
Expand All @@ -11,7 +11,7 @@
]
}
},
"create-dataverse": {
"create-frontend": {
"min-valid": {
"users": [
"dataverseAdmin"
Expand Down
9 changes: 6 additions & 3 deletions src/dvtests/testing/default/system/test_datafiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait

from ..conftest import CONFIG
from ..conftest import read_json
from ..conftest import TESTING_CONFIG_DIR
from ..conftest import UTILS_DATA_DIR


testdata = read_json(os.path.join(UTILS_DATA_DIR, "datafiles.json",))
testdata = read_json(os.path.join(UTILS_DATA_DIR, CONFIG.FILENAME_DATAFILES))
test_config = read_json(
os.path.join(TESTING_CONFIG_DIR, "default/system/test-config_datafiles.json",)
)


class TestAllDatafiles:
class TestAccess:
@pytest.mark.v4_20
@pytest.mark.utils
@pytest.mark.parametrize("datafiles", testdata)
Expand Down Expand Up @@ -53,12 +54,14 @@ def test_page_not_logged_in(self, config, selenium, datafiles):
assert selenium.current_url == url
# Cleanup


class TestSidebar:
@pytest.mark.v4_20
@pytest.mark.utils
@pytest.mark.selenium
@pytest.mark.parametrize(
"test_input,expected",
test_config["all-datafiles"]["facet-not-logged-in"]["input-expected"],
test_config["sidebar"]["facet-not-logged-in"]["input-expected"],
)
def test_facet_not_logged_in(self, config, selenium, test_input, expected):
"""Test all Datafiles in facet as not-logged-in user."""
Expand Down
9 changes: 6 additions & 3 deletions src/dvtests/testing/default/system/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait

from ..conftest import CONFIG
from ..conftest import read_json
from ..conftest import TESTING_CONFIG_DIR
from ..conftest import UTILS_DATA_DIR


testdata = read_json(os.path.join(UTILS_DATA_DIR, "datasets.json",))
testdata = read_json(os.path.join(UTILS_DATA_DIR, CONFIG.FILENAME_DATASETS,))
test_config = read_json(
os.path.join(TESTING_CONFIG_DIR, "default/system/test-config_datasets.json",)
)


class TestAllDatasets:
class TestAccess:
@pytest.mark.v4_20
@pytest.mark.utils
@pytest.mark.parametrize("test_input", testdata)
Expand Down Expand Up @@ -48,12 +49,14 @@ def test_doiorg_url(self, config, session, test_input):
assert resp.url == url_end
# Cleanup


class TestSidebar:
@pytest.mark.v4_20
@pytest.mark.selenium
@pytest.mark.utils
@pytest.mark.parametrize(
"test_input,expected",
test_config["all-datasets"]["facet-not-logged-in"]["input-expected"],
test_config["sidebar"]["facet-not-logged-in"]["input-expected"],
)
def test_facet_not_logged_in(self, config, homepage, test_input, expected):
"""Test all Datasets in facet as not-logged-in user."""
Expand Down
13 changes: 8 additions & 5 deletions src/dvtests/testing/default/system/test_dataverses.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,24 @@
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait

from ..conftest import CONFIG
from ..conftest import read_json
from ..conftest import TESTING_CONFIG_DIR
from ..conftest import UTILS_DATA_DIR


all_dataverses = read_json(os.path.join(UTILS_DATA_DIR, "dataverses.json"))
all_dataverses = read_json(os.path.join(UTILS_DATA_DIR, CONFIG.FILENAME_DATAVERSES))
test_config = read_json(
os.path.join(TESTING_CONFIG_DIR, "default/system/test-config_dataverses.json")
)


class TestCreateDataverse:
class TestCreateFrontend:
@pytest.mark.v4_20
@pytest.mark.selenium
@pytest.mark.parametrize(
"homepage_logged_in",
test_config["create-dataverse"]["min-valid"]["users"],
test_config["create-frontend"]["min-valid"]["users"],
indirect=True,
)
def test_min_valid(
Expand Down Expand Up @@ -143,7 +144,7 @@ def test_min_valid(
api.delete_dataverse(dv.get()["alias"])


class TestAllDataverses:
class TestAccess:
@pytest.mark.v4_20
@pytest.mark.utils
@pytest.mark.parametrize("test_input", all_dataverses)
Expand Down Expand Up @@ -174,12 +175,14 @@ def test_clean_url_not_logged_in(self, config, session, test_input):
assert resp.url == url
# Cleanup


class TestSidebar:
@pytest.mark.v4_20
@pytest.mark.utils
@pytest.mark.selenium
@pytest.mark.parametrize(
"test_input,expected",
test_config["all-dataverses"]["facet-not-logged-in"]["input-expected"],
test_config["sidebar"]["facet-not-logged-in"]["input-expected"],
)
def test_facet_not_logged_in(self, config, homepage, test_input, expected):
"""Test all Dataverse collections in facet as not-logged-in user."""
Expand Down

0 comments on commit cafd428

Please sign in to comment.