@@ -96,15 +96,22 @@ def test_get_script_name(self):
96
96
self .assertEqual (handle_config .get_script_name (), "inputs" )
97
97
98
98
99
- def test_setup_default_inputs (self ):
100
- tempdir = tempfile .gettempdir ()
101
- mock_path = os .path .join (tempdir , 'mock_inputs.py' )
102
- # Make sure file does not exist from previous tests
103
- try :
104
- os .remove (mock_path )
105
- except FileNotFoundError :
106
- pass
99
+ def test_setup_config_dir (self ):
100
+ tempdir = tempfile .TemporaryDirectory ()
101
+ handle_config .setup_config_dir (tempdir .name )
102
+
103
+ vesuvio_file = open (os .path .join (tempdir .name , "vesuvio.user.properties" ), "r" )
104
+ self .assertEqual (vesuvio_file .read (), "caching.inputs=\n caching.ipfolder=\n " )
105
+ vesuvio_file .close ()
106
+ mantid_file = open (os .path .join (tempdir .name , "Mantid.user.properties" ), "r" )
107
+ self .assertEqual (mantid_file .read (), "default.facility=ISIS\n default.instrument=Vesuvio\n datasearch.searcharchive=On\n " )
108
+ mantid_file .close ()
109
+ tempdir .cleanup ()
110
+
107
111
112
+ def test_setup_default_inputs (self ):
113
+ tempdir = tempfile .TemporaryDirectory ()
114
+ mock_path = os .path .join (tempdir .name , 'mock_inputs.py' )
108
115
with patch .object (handle_config , "VESUVIO_INPUTS_PATH" , mock_path ):
109
116
110
117
handle_config .setup_default_inputs ()
@@ -125,4 +132,5 @@ def test_setup_default_inputs(self):
125
132
file = open (mock_path , 'r' )
126
133
self .assertEqual (original_content , file .read ())
127
134
file .close ()
128
- os .remove (mock_path )
135
+ tempdir .cleanup ()
136
+
0 commit comments