Script for the transfer of data from Mongo to SQL (#80)

This commit is contained in:
2023-09-11 20:21:35 +02:00
committed by GitHub
parent 2ea99c8c17
commit d64f53eca9
22 changed files with 1565 additions and 73 deletions

View File

@ -1,3 +1,4 @@
"""Tests the config provers."""
import json
from unittest.mock import mock_open, patch
@ -10,11 +11,13 @@ from aki_prj23_transparenzregister.config.config_providers import (
def test_json_provider_init_fail() -> None:
"""Tests the file not found error if an unknown filepath is given for the JsonFileConfigProvider."""
with pytest.raises(FileNotFoundError):
JsonFileConfigProvider("file-that-does-not-exist")
def test_json_provider_init_no_json() -> None:
"""Tests if a non json file throws the correct error."""
with patch("os.path.isfile") as mock_isfile, patch(
"builtins.open", mock_open(read_data="fhdaofhdoas")
):
@ -24,6 +27,7 @@ def test_json_provider_init_no_json() -> None:
def test_json_provider_init() -> None:
"""Tests the JsonFileConfigProvider creation."""
data = {"hello": "world"}
input_data = json.dumps(data)
with patch("os.path.isfile") as mock_isfile:
@ -34,6 +38,7 @@ def test_json_provider_init() -> None:
def test_json_provider_get_postgres() -> None:
"""Tests if the config provider can return the postgre config string."""
data = {
"postgres": {
"username": "user",
@ -56,6 +61,7 @@ def test_json_provider_get_postgres() -> None:
def test_json_provider_get_mongo() -> None:
"""Tests the JsonConfigProvider for the mongo db."""
data = {
"mongo": {
"username": "user",