diff options
Diffstat (limited to 'ick2/projectapi_tests.py')
-rw-r--r-- | ick2/projectapi_tests.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/ick2/projectapi_tests.py b/ick2/projectapi_tests.py index bdb58d1..b6ec9e9 100644 --- a/ick2/projectapi_tests.py +++ b/ick2/projectapi_tests.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2019 Lars Wirzenius +# Copyright (C) 2017-2018 Lars Wirzenius # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -14,31 +14,30 @@ import os +import shutil +import tempfile import unittest import ick2 -class DummyTokenGetter: - - def get_token(self): - return 'DUMMY.TOKEN' - - class ProjectAPITests(unittest.TestCase): def setUp(self): - self.state = ick2.MemoryStore() + self.tempdir = tempfile.mkdtemp() + self.statedir = os.path.join(self.tempdir, 'state/dir') + self.state = ick2.FilePersistentState() + self.state.set_directory(self.statedir) + + def tearDown(self): + shutil.rmtree(self.tempdir) def create_api(self): return ick2.ProjectAPI(self.state) def create_pipeline_api(self): - getter = DummyTokenGetter() - api = ick2.PipelineAPI(self.state) - api.set_token_getter(getter) - return api + return ick2.PipelineAPI(self.state) def test_has_not_projects_initially(self): api = self.create_api() |