|
4 | 4 | # Copyright © 2020 ISIS Rutherford Appleton Laboratory UKRI
|
5 | 5 | # ##################################################################################### #
|
6 | 6 | """
|
7 |
| -Unit tests for ingest |
| 7 | +Unit tests for run_detection |
8 | 8 | """
|
9 | 9 | import unittest
|
10 | 10 | import os
|
|
13 | 13 | from filelock import FileLock
|
14 | 14 | from mock import Mock, patch, call
|
15 | 15 |
|
16 |
| -from isis_file_polling.ingest import InstrumentMonitor, InstrumentMonitorError, update_last_runs, main |
17 |
| -from isis_file_polling.settings import AUTOREDUCE_API_URL, LOCAL_CACHE_LOCATION |
| 16 | +from autoreduce_run_detection.run_detection import InstrumentMonitor, InstrumentMonitorError, update_last_runs, main |
| 17 | +from autoreduce_run_detection.settings import AUTOREDUCE_API_URL, LOCAL_CACHE_LOCATION |
18 | 18 |
|
19 | 19 | # Test data
|
20 | 20 | SUMMARY_FILE = ("WIS44731Smith,Smith,"
|
@@ -109,7 +109,7 @@ def test_submit_run_difference(self):
|
109 | 109 | self.assertEqual(run_number, '44733')
|
110 | 110 | inst_mon.submit_runs.assert_has_calls([call(44732, 44734)])
|
111 | 111 |
|
112 |
| - @patch('isis_file_polling.ingest.requests.post', return_value='44736') |
| 112 | + @patch('autoreduce_run_detection.run_detection.requests.post', return_value='44736') |
113 | 113 | def test_update_last_runs(self, requests_post_mock: Mock):
|
114 | 114 | # write out the local lastruns.csv that is used to track each instrument
|
115 | 115 | with open('test_last_runs.csv', 'w') as last_runs:
|
@@ -149,13 +149,13 @@ def test_update_last_runs_with_error(self, requests_post_mock: Mock):
|
149 | 149 | if row: # Avoid the empty rows
|
150 | 150 | self.assertEqual('44733', row[1])
|
151 | 151 |
|
152 |
| - @patch('isis_file_polling.ingest.update_last_runs') |
| 152 | + @patch('autoreduce_run_detection.run_detection.update_last_runs') |
153 | 153 | def test_main(self, update_last_runs_mock):
|
154 | 154 | main()
|
155 | 155 | update_last_runs_mock.assert_called_with(LOCAL_CACHE_LOCATION)
|
156 | 156 | update_last_runs_mock.assert_called_once()
|
157 | 157 |
|
158 |
| - @patch('isis_file_polling.ingest.update_last_runs') |
| 158 | + @patch('autoreduce_run_detection.run_detection.update_last_runs') |
159 | 159 | def test_main_lock_timeout(self, _):
|
160 | 160 | with FileLock('{}.lock'.format(LOCAL_CACHE_LOCATION)):
|
161 | 161 | main()
|
0 commit comments