One more instance of the file duplicate problem.
@@ -75,6 +75,12 @@ class TestMODFLOWModelInstanceMetaData(MockIRODSTestCaseMixin, TransactionTestCa
text_file.write("Model Instance resource files")
self.text_file_obj = open(temp_text_file, 'r')
+ self.file_name_2 = "MIR2.txt"
+ temp_text_file_2 = os.path.join(self.temp_dir, self.file_name_2)
+ text_file_2 = open(temp_text_file_2, 'w')
+ text_file_2.write("Model Instance resource files")
+ self.text_file_obj_2 = open(temp_text_file_2, 'r')
+
def tearDown(self):
super(TestMODFLOWModelInstanceMetaData, self).tearDown()
if os.path.exists(self.temp_dir):
@@ -91,7 +97,6 @@ class TestMODFLOWModelInstanceMetaData(MockIRODSTestCaseMixin, TransactionTestCa
files = [UploadedFile(file=self.text_file_obj, name=self.text_file_obj.name)]
utils.resource_file_add_pre_process(resource=self.res, files=files, user=self.user,
extract_metadata=False)
-
utils.resource_file_add_process(resource=self.res, files=files, user=self.user,
extract_metadata=False)
@@ -103,17 +108,12 @@ class TestMODFLOWModelInstanceMetaData(MockIRODSTestCaseMixin, TransactionTestCa
self.assertEqual(self.res.metadata.executed_by, None)
# Upload any other file type should pass both the file pre add check post add check
- files = [UploadedFile(file=self.text_file_obj, name=self.text_file_obj.name)]
+ files = [UploadedFile(file=self.text_file_obj_2, name=self.text_file_obj_2.name)]
utils.resource_file_add_pre_process(resource=self.res, files=files, user=self.user,
extract_metadata=True)
-
utils.resource_file_add_process(resource=self.res, files=files, user=self.user,
extract_metadata=True)
- print("the files are:")
- for f in self.res.files.all():
- print(" path is {}".format(f.storage_path))
-
# there should two content files
self.assertEqual(self.res.files.all().count(), 2)
