Skip to content
Snippets Groups Projects
Commit 01f210a6 authored by lukas leufen's avatar lukas leufen
Browse files

Merge branch 'lukas_issue237_test_new-tests-for-configuration' into 'develop'

Resolve "new tests for configuration"

See merge request toar/mlair!223
parents 33cd7867 89fd79f6
No related branches found
No related tags found
3 merge requests!226Develop,!225Resolve "release v1.2.0",!223Resolve "new tests for configuration"
Pipeline #55681 passed
from mlair.configuration.join_settings import join_settings
import pytest
class TestJoinSettings:
def test_no_args(self):
url, headers = join_settings()
assert url == 'https://join.fz-juelich.de/services/rest/surfacedata/'
assert headers == {}
def test_daily(self):
url, headers = join_settings("daily")
assert url == 'https://join.fz-juelich.de/services/rest/surfacedata/'
assert headers == {}
def test_hourly(self):
url, headers = join_settings("hourly")
assert "Authorization" in headers.keys()
def test_unknown_sampling(self):
with pytest.raises(NameError) as e:
join_settings("monthly")
assert "Given sampling monthly is not supported, choose from either daily or hourly sampling" in e.value.args[0]
......@@ -27,6 +27,10 @@ class TestPrepareHost:
def test_prepare_host_unknown(self, mock_user, mock_host):
assert prepare_host() == os.path.join(os.path.abspath(os.getcwd()), 'data')
def test_prepare_host_given_path(self):
path = os.path.join(os.path.abspath(os.getcwd()), 'data')
assert prepare_host(data_path=path) == path
@mock.patch("getpass.getuser", return_value="zombie21")
@mock.patch("mlair.configuration.path_config.check_path_and_create", side_effect=PermissionError)
@mock.patch("os.path.exists", return_value=False)
......
......@@ -7,14 +7,6 @@ from mlair.helpers.join import _save_to_pandas, _correct_stat_name, _lower_list,
from mlair.configuration.join_settings import join_settings
class TestJoinUrlBase:
def test_url(self):
url, headers = join_settings()
assert url == 'https://join.fz-juelich.de/services/rest/surfacedata/'
assert headers == {}
class TestDownloadJoin:
def test_download_single_var(self):
......
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment