Commit 05d35f5f authored by FH's avatar FH

in test cases change conf file

to conf/pacman-mirrors.conf
parent e5dd2517
......@@ -28,6 +28,7 @@ class TestPacmanMirrors(unittest.TestCase):
"-m", "random",
"-d", "data/mirrors"]):
app = pacman_mirrors.PacmanMirrors()
app.config["config_file"] = "conf/pacman-mirrors.conf"
app.command_line_parse()
app.load_server_lists()
......@@ -42,6 +43,7 @@ class TestPacmanMirrors(unittest.TestCase):
"-m", "random",
"-d", "data/mirrors"]):
app = pacman_mirrors.PacmanMirrors()
app.config["config_file"] = "conf/pacman-mirrors.conf"
app.command_line_parse()
app.load_server_lists()
assert app.config["only_country"] == ["Germany"]
......@@ -59,6 +61,7 @@ class TestPacmanMirrors(unittest.TestCase):
"-m", "random",
"-d", "data/mirrors"]):
app = pacman_mirrors.PacmanMirrors()
app.config["config_file"] = "conf/pacman-mirrors.conf"
app.command_line_parse()
app.load_server_lists()
assert app.config["only_country"] == ["France"]
......@@ -76,6 +79,7 @@ class TestPacmanMirrors(unittest.TestCase):
"-m", "random",
"-d", "data/mirrors"]):
app = pacman_mirrors.PacmanMirrors()
app.config["config_file"] = "conf/pacman-mirrors.conf"
app.config["only_country"] = []
app.command_line_parse()
app.load_server_lists()
......@@ -85,6 +89,7 @@ class TestPacmanMirrors(unittest.TestCase):
def test_resp_time_calc(self, mock_calc):
"""Calculate mirror response time"""
app = pacman_mirrors.PacmanMirrors()
app.config["config_file"] = "conf/pacman-mirrors.conf"
mock_calc.return_value = "0.067"
assert app.get_mirror_response_time(
"1486371026.6549892", "1486371026.7216527") == "0.067"
......@@ -99,6 +104,7 @@ class TestPacmanMirrors(unittest.TestCase):
def test_last_sync_calc(self, mock_calc):
"""Calculate mirror last_sync offset"""
app = pacman_mirrors.PacmanMirrors()
app.config["config_file"] = "conf/pacman-mirrors.conf"
mock_calc.return_value = "2189:29"
assert app.get_mirror_branch_last_sync(
"2017-02-06 11:39:14.610344", "2016-11-07 06:09:51") == "2189:29"
......@@ -114,6 +120,7 @@ class TestPacmanMirrors(unittest.TestCase):
"""Extract mirror url from input"""
mock_url.return_value = "http://mirror.domain.tld"
app = pacman_mirrors.PacmanMirrors()
app.config["config_file"] = "conf/pacman-mirrors.conf"
mock_data = "Server = http://mirror.domain.tld"
assert app.get_mirror_url(mock_data) == "http://mirror.domain.tld"
......@@ -122,6 +129,7 @@ class TestPacmanMirrors(unittest.TestCase):
"""Extract mirror country from input"""
mock_country.return_value = "France"
app = pacman_mirrors.PacmanMirrors()
app.config["config_file"] = "conf/pacman-mirrors.conf"
mock_data = "## Country : France"
assert app.get_mirror_country(mock_data) == "France"
mock_data = "## Location : France"
......@@ -134,6 +142,7 @@ class TestPacmanMirrors(unittest.TestCase):
"""Extract timestamp from input"""
mock_timestamp.return_value = "2017-02-06T07:18:43Z"
app = pacman_mirrors.PacmanMirrors()
app.config["config_file"] = "conf/pacman-mirrors.conf"
mock_data = "date=2017-02-06T07:18:43Z"
assert app.get_mirror_branch_timestamp(mock_data) == "2017-02-06T07:18:43Z"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment