Beispiel #1
0
    def test_initNotEmpty(self):
        # Setup
        area = getUid()
        path = self.home / area
        S1 = FileCache.StorageArea(str(path))
        ctxt = getUid()
        S1.addContext(ctxt)

        # Test
        S2 = FileCache.StorageArea(str(path))
        k = ctxt in S2.contexts
        self.assertTrue(k)
        shutil.rmtree(str(path))
Beispiel #2
0
 def test_test2(self):
     nextContext = getUid()
     S = FileCache.StorageArea(str(self.home / 'EuclidCache'))
     C = S.addContext(nextContext)
     C.load("export.json")
     C.refresh()
     shutil.rmtree(str(self.home / 'EuclidCache'))
Beispiel #3
0
 def test_delContextNoExist(self):
     area = getUid()
     path = self.home / area
     S1 = FileCache.StorageArea(str(path))
     ctxt = getUid()
     S1.addContext(ctxt)
     S1.deleteContext('foo')
     shutil.rmtree(str(path))
Beispiel #4
0
 def test_addContextDup(self):
     area = getUid()
     path = self.home / area
     S1 = FileCache.StorageArea(str(path))
     ctxt = getUid()
     S1.addContext(ctxt)
     S1.addContext(ctxt)
     shutil.rmtree(str(path))
Beispiel #5
0
 def test_addContextNotWritable(self):
     area = getUid()
     path = self.home / area
     S1 = FileCache.StorageArea(str(path))
     os.chmod(str(path), 0o0077)
     ctxt = getUid()
     S1.addContext(ctxt)
     os.chmod(str(path), 0o0777)
     shutil.rmtree(str(path))
Beispiel #6
0
 def test_addContextDirExist(self):
     area = getUid()
     path = self.home / area
     S1 = FileCache.StorageArea(str(path))
     ctxt = getUid()
     dupDir = path / ctxt
     dupDir.mkdir()
     S1.addContext(ctxt, True)
     shutil.rmtree(str(path))
Beispiel #7
0
 def test_addContext(self):
     area = getUid()
     path = self.home / area
     S1 = FileCache.StorageArea(str(path))
     ctxt = getUid()
     S1.addContext(ctxt)
     cDir = S1.storagePath / ctxt
     self.assertTrue(cDir.exists())
     shutil.rmtree(str(path))
Beispiel #8
0
 def test_test3(self):
     next2Context = getUid()
     S = FileCache.StorageArea(str(self.home / 'EuclidCache'))
     C = S.addContext(next2Context)
     C.load(
         "http://vospace.esac.esa.int/vospace/sh/4807f490cec42f15d1574442881ccb1f1275bd?dl=1"
     )
     C.refresh()
     shutil.rmtree(str(self.home / 'EuclidCache'))
Beispiel #9
0
 def test_getFileNotExists(self):
     area = getUid()
     path = self.home / area
     S1 = FileCache.StorageArea(str(path))
     ctxt = getUid()
     C1 = S1.addContext(ctxt)
     C1.addFile("http://vospace.esac.esa.int/vospace/sh/blah", "foo.pdf")
     C1.getFile("foo.pdf")
     shutil.rmtree(str(path))
Beispiel #10
0
 def test_delContextNotWritable(self):
     area = getUid()
     path = self.home / area
     S1 = FileCache.StorageArea(str(path))
     ctxt = getUid()
     S1.addContext(ctxt)
     S1.writable = False
     S1.deleteContext(ctxt)
     shutil.rmtree(str(path))
Beispiel #11
0
 def test_addFile(self):
     area = getUid()
     path = self.home / area
     S1 = FileCache.StorageArea(str(path))
     ctxt = getUid()
     C1 = S1.addContext(ctxt)
     C1.addFile(
         "http://vospace.esac.esa.int/vospace/sh/eb9834b594e8da89111147899d15c26dd5ecf9?dl=1",
         "foo.pdf")
     shutil.rmtree(str(path))
Beispiel #12
0
 def test_test1(self):
     S = FileCache.StorageArea(str(self.home / 'EuclidCache'))
     testContext = getUid()
     C = S.addContext(testContext)
     C.addFile(
         "http://vospace.esac.esa.int/vospace/sh/eb9834b594e8da89111147899d15c26dd5ecf9?dl=1",
         "foo.pdf")
     C.getFile("foo.pdf")
     C.export("export.json")
     C.deleteFile("foo.pdf")
     S.deleteContext(testContext)
     shutil.rmtree(str(self.home / 'EuclidCache'))
Beispiel #13
0
 def test_test4(self):
     next3Context = getUid()
     S = FileCache.StorageArea(str(self.home / 'EuclidCache'))
     C = S.addContext(next3Context)  # TODO Should check for existing dirs
     C.addFile(
         "http://vospace.esac.esa.int/vospace/sh/66ee2fc9964193fcc2984e35a25bdee14057f9?dl=1",
         "ick906030_prev.fits")
     C.export("export1.json")
     C.addFile(
         "http://vospace.esac.esa.int/vospace/sp/e09e212133c2c61093431c4eb13ed16e7e31bb36?dl=2",
         "1525190698647O-result.vot")
     C.export("export2.json")
     S.deleteContext(next3Context)  # TODO Check for context
     shutil.rmtree(str(self.home / 'EuclidCache'))
Beispiel #14
0
 def test_test5(self):
     S = FileCache.StorageArea(str(self.home / 'EuclidCache'))
     S.listContexts()
     shutil.rmtree(str(self.home / 'EuclidCache'))
Beispiel #15
0
 def test_initEmpty(self):
     path = self.home / getUid()
     S = FileCache.StorageArea(str(path))
     self.assertTrue(S.storagePath.exists())
     shutil.rmtree(str(path))