diff options
| author | jfriedli | 2020-04-23 10:39:35 -0700 |
|---|---|---|
| committer | jfriedli | 2020-04-23 10:39:35 -0700 |
| commit | e1bac8b6a7fd857f38b7bcb678398c82baaa8fd5 (patch) | |
| tree | fa87e526289e455f2f17b86973d08eb6850e721f /test/test.py | |
| parent | d14988fa3fa97f549fb8eaf601cb2c687cdce143 (diff) | |
Refactoring
Diffstat (limited to 'test/test.py')
| -rw-r--r-- | test/test.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/test.py b/test/test.py index f871bb9..02216ac 100644 --- a/test/test.py +++ b/test/test.py | |||
| @@ -13,11 +13,12 @@ import main | |||
| 13 | class Mat2WebTestCase(unittest.TestCase): | 13 | class Mat2WebTestCase(unittest.TestCase): |
| 14 | def setUp(self): | 14 | def setUp(self): |
| 15 | os.environ.setdefault('MAT2_ALLOW_ORIGIN_WHITELIST', 'origin1.gnu origin2.gnu') | 15 | os.environ.setdefault('MAT2_ALLOW_ORIGIN_WHITELIST', 'origin1.gnu origin2.gnu') |
| 16 | app = main.create_app() | ||
| 17 | self.upload_folder = tempfile.mkdtemp() | 16 | self.upload_folder = tempfile.mkdtemp() |
| 18 | app.config.update( | 17 | app = main.create_app( |
| 19 | TESTING=True, | 18 | test_config={ |
| 20 | UPLOAD_FOLDER=self.upload_folder | 19 | 'TESTING': True, |
| 20 | 'UPLOAD_FOLDER': self.upload_folder | ||
| 21 | } | ||
| 21 | ) | 22 | ) |
| 22 | self.app = app.test_client() | 23 | self.app = app.test_client() |
| 23 | 24 | ||
| @@ -127,7 +128,7 @@ class Mat2WebTestCase(unittest.TestCase): | |||
| 127 | rv = self.app.get('/download/70623619c449a040968cdbea85945bf384fa30ed2d5d24fa3/test.cleaned.txt') | 128 | rv = self.app.get('/download/70623619c449a040968cdbea85945bf384fa30ed2d5d24fa3/test.cleaned.txt') |
| 128 | self.assertEqual(rv.status_code, 302) | 129 | self.assertEqual(rv.status_code, 302) |
| 129 | 130 | ||
| 130 | @patch('file_removal_scheduler.random.randint') | 131 | @patch('matweb.file_removal_scheduler.random.randint') |
| 131 | def test_upload_leftover(self, randint_mock): | 132 | def test_upload_leftover(self, randint_mock): |
| 132 | randint_mock.return_value = 0 | 133 | randint_mock.return_value = 0 |
| 133 | os.environ['MAT2_MAX_FILE_AGE_FOR_REMOVAL'] = '0' | 134 | os.environ['MAT2_MAX_FILE_AGE_FOR_REMOVAL'] = '0' |
