From 2ce4dcdcf2b9d03e72c00c5c322a33e50da7dd96 Mon Sep 17 00:00:00 2001 From: "Vriezen, E.C. (Emma)" <e.vriezen@student.ru.nl> Date: Tue, 21 Jan 2020 17:23:54 +0100 Subject: [PATCH] Updated the test so that it accounts for the dynamic file output naming. --- umbra/tests/test_controller.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/umbra/tests/test_controller.py b/umbra/tests/test_controller.py index 94ebd67c..64c541e3 100644 --- a/umbra/tests/test_controller.py +++ b/umbra/tests/test_controller.py @@ -2,6 +2,7 @@ import unittest import unittest.mock as mock from ..controller import Controller import pyfakefs +from time import localtime, strftime class ControllerTest(pyfakefs.fake_filesystem_unittest.TestCase): @@ -109,8 +110,13 @@ class ControllerTest(pyfakefs.fake_filesystem_unittest.TestCase): controller._filewriter = fw controller._save_results() view.ask_save_location.assert_called() - fw.write_frame.assert_has_calls([mock.call("baz/bar/yit", "bar", "mistakes.csv"), - mock.call("baz/bar/yit", "foo", "delay.csv")]) + algorithm = model.last_used_algorithm() + time = strftime("%d%m%y_%H%M%S", localtime()) + title1 = "mistakes_{}_{}.csv".format(algorithm, time) + time = strftime("%d%m%y_%H%M%S", localtime()) + title2 = "delay_{}_{}.csv".format(algorithm, time) + fw.write_frame.assert_has_calls([mock.call("baz/bar/yit", "bar", title1), + mock.call("baz/bar/yit", "foo", title2)]) view.update_message.assert_called_with("saved") def test_select_folder(self): -- GitLab