コード例 #1
0
    def test_s3_rmtree(self):
        token = '{ts}-{r}'.format(ts=int(time.time()), r=randstr())
        path0 = 'gs://futsu-test/test-HOSPFEUB-{token}'.format(token=token)
        path00 = storage.join(path0, 'WKBXFDTH', 'CMCXBJYN')
        path01 = storage.join(path0, 'MGNZJTXL', 'RGWIYPEG')

        storage.bytes_to_path(path00, b'')
        storage.bytes_to_path(path01, b'')

        self.assertTrue(storage.is_blob_exist(path00))
        self.assertTrue(storage.is_blob_exist(path01))

        storage.rmtree(path0)

        self.assertFalse(storage.is_blob_exist(path00))
        self.assertFalse(storage.is_blob_exist(path01))
コード例 #2
0
    def test_local_rmtree(self):
        with tempfile.TemporaryDirectory() as tempdir:
            path0 = storage.join(tempdir, 'XMTLIIPP')
            path00 = storage.join(path0, 'WKBXFDTH', 'CMCXBJYN')
            path01 = storage.join(path0, 'MGNZJTXL', 'RGWIYPEG')

            storage.bytes_to_path(path00, b'')
            storage.bytes_to_path(path01, b'')

            self.assertTrue(storage.is_blob_exist(path00))
            self.assertTrue(storage.is_blob_exist(path01))

            storage.rmtree(path0)

            self.assertFalse(storage.is_blob_exist(path00))
            self.assertFalse(storage.is_blob_exist(path01))
コード例 #3
0
 def test_local_dirname(self):
     with tempfile.TemporaryDirectory() as tempdir:
         path0 = storage.join(tempdir, 'GMJZWWTM')
         self.assertEqual(storage.dirname(path0), tempdir)
コード例 #4
0
 def test_http_join(self):
     self.assertEqual(storage.join('http://UHMNFEYK', 'XFGBYFFR'),
                      'http://UHMNFEYK/XFGBYFFR')
     self.assertEqual(storage.join('https://UHMNFEYK', 'XFGBYFFR'),
                      'https://UHMNFEYK/XFGBYFFR')
コード例 #5
0
 def test_s3_join(self):
     self.assertEqual(storage.join('s3://PISXTKBK', 'EIQDPMWQ'),
                      's3://PISXTKBK/EIQDPMWQ')
コード例 #6
0
 def test_gcp_join(self):
     self.assertEqual(storage.join('gs://DHLQJSEX', 'PFMSXIDP'),
                      'gs://DHLQJSEX/PFMSXIDP')
コード例 #7
0
 def test_local_join(self):
     with tempfile.TemporaryDirectory() as tempdir:
         self.assertEqual(storage.join(tempdir, 'GMJZWWTM'),
                          os.path.join(tempdir, 'GMJZWWTM'))