Skip to content

Commit

Permalink
re-factor default system tests; re-structure settings management
Browse files Browse the repository at this point in the history
  • Loading branch information
skasberger committed May 3, 2021
1 parent 0ba55f4 commit 1d10fae
Show file tree
Hide file tree
Showing 24 changed files with 605 additions and 485 deletions.
13 changes: 5 additions & 8 deletions src/dvtests/__main__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import os
from typing import List

import typer
from utils import collect_data
from utils import create_testdata
from utils import create_user
from utils import generate_data
from utils import INSTANCE_DATA_DIR
from utils import remove_testdata
from utils import ROOT_DIR


app = typer.Typer()
Expand All @@ -22,25 +19,25 @@ def collect_command(
create_json: bool = False,
) -> None:
collect_data(parent, data_types, filename, create_json)
typer.echo(f"Data collected")
typer.echo("Data collected")


@app.command("generate")
def generate_command() -> None:
generate_data()
typer.echo(f"Data generated")
typer.echo("Data generated")


@app.command("create-testdata")
def create_testdata_command(config_file: str, force: bool = False) -> None:
create_testdata(config_file, force)
typer.echo(f"Testdata created")
typer.echo("Testdata created")


@app.command("create-user")
def create_user_command(config_file: str, force: bool = False) -> None:
create_user(config_file, force)
typer.echo(f"User created")
typer.echo("User created")


@app.command("remove-testdata")
Expand All @@ -51,7 +48,7 @@ def remove_testdata_command(
force: bool = False,
) -> None:
remove_testdata(parent, parent_data_type, data_types, force)
typer.echo(f"Testdata removed")
typer.echo("Testdata removed")


if __name__ == "__main__":
Expand Down
41 changes: 0 additions & 41 deletions src/dvtests/config.py

This file was deleted.

34 changes: 34 additions & 0 deletions src/dvtests/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from typing import List

from pydantic import BaseSettings


class UtilsSettings(BaseSettings):
BASE_URL: str
INSTANCE: str
PRODUCTION: bool = False
FILENAME_DATAVERSES: str = "dataverses.json"
FILENAME_DATASETS: str = "datasets.json"
FILENAME_DATAFILES: str = "datafiles.json"
FILENAME_METADATA: str = "metadata.json"
BUILTIN_USER_KEY: str = None


class TestSettings(BaseSettings):
BASE_URL: str
INSTANCE: str
USER_FILENAME: str
DATA_COLLECTOR: str
HEADLESS: bool = True
USER_AGENT: str = "TESTING"
WINDOW_HEIGHT: int = 1400
WINDOW_WIDTH: int = 1600
MAX_WAIT_TIME: int = 10
LOGIN_OPTIONS: List[str] = ["normal"]
FILENAME_DATAVERSES: str = "dataverses.json"
FILENAME_DATASETS: str = "datasets.json"
FILENAME_DATAFILES: str = "datafiles.json"
FILENAME_METADATA: str = "metadata.json"
SHIBBOLETH_INSTITUTION: str = None
SHIBBOLETH_LOGIN_PAGE_TITLE: str = None
BUILTIN_USER_KEY: str = None
Loading

0 comments on commit 1d10fae

Please sign in to comment.