예제 #1
0
 def test_execute_dir_empty(self):
     "Processing directory with no files does nothing"
     print()
     options = {"images_path": self.empty_dir, "verbose": True}
     rets = up.execute(options)
     self.assertNotEqual(rets, None)
     self.assertEqual(len(rets), 0)
예제 #2
0
 def test_execute_dir(self):
     "Process a directory with several FITS files at once"
     print()
     options = {"images_path": self.test_dir, "verbose": True}
     rets = up.execute(options)
     self.assertNotEqual(rets, None)
     self.assertEqual(len(rets), self.test_dir_fits_count)
     self.assertTrue(all(rets))
예제 #3
0
 def test_execute_file1(self):
     "Process a single FITS file to the astrolabe directory"
     print()
     upfile = self.test_file
     basefile = os.path.basename(upfile)
     options = {
         "images_path": upfile,
         "verbose": True,
         "ignore_keys": self.ignored_keys
     }
     rets = up.execute(options)  # the test call
     self.assertNotEqual(rets, None)
     self.assertEqual(len(rets), 1)
     self.assertTrue(all(rets))
     # now fetch and test the metadata just created:
     md = self.ihelper.get_metaf("{}/{}".format(self.root_dir, basefile))
     self.assertNotEqual(md, None)
     self.assertEqual(type(md), list)
     # [print(item) for item in md]            # DEBUGGING
     self.assertEqual(len(md), self.test_file_md_count)
예제 #4
0
 def test_execute_dots_mixed(self):
     "Throws exception on image path with mixed single and double dots"
     with self.assertRaises(SystemExit):
         options = {"images_path": "./..", "verbose": True}
         up.execute(options)
예제 #5
0
 def test_execute_dots2_trailing(self):
     "Throws exception on image path with trailing double dots"
     with self.assertRaises(SystemExit):
         options = {"images_path": "resources/test2/..", "verbose": True}
         up.execute(options)
예제 #6
0
 def test_execute_2dots_inner(self):
     "Throws exception on image path with embedded double dots"
     with self.assertRaises(SystemExit):
         options = {"images_path": "resources/../test2", "verbose": True}
         up.execute(options)
예제 #7
0
 def test_execute_dots2_leading(self):
     "Throws exception on image path with double leading dots"
     with self.assertRaises(SystemExit):
         options = {"images_path": "../resources", "verbose": True}
         up.execute(options)
예제 #8
0
 def test_execute_dots2(self):
     "Throws exception on image path of a double dot"
     with self.assertRaises(SystemExit):
         options = {"images_path": "..", "verbose": True}
         up.execute(options)