Example #1
0
 def test_get_container_details_from_fs(self):
     td = tempfile.mkdtemp()
     tf = tarfile.open("common/data/account_tree.tar.bz2", "r:bz2")
     orig_cwd = os.getcwd()
     os.chdir(td)
     tf.extractall()
     try:
         ad = utils._get_account_details_from_fs(td, None)
         assert ad.mtime == os.path.getmtime(td)
         assert ad.container_count == 3
         assert set(ad.container_list) == set(['c1', 'c2', 'c3'])
     finally:
         os.chdir(orig_cwd)
         shutil.rmtree(td)
Example #2
0
 def test_get_account_details_from_fs_notadir(self):
     tf = tempfile.NamedTemporaryFile()
     ad = utils._get_account_details_from_fs(tf.name, None)
     assert ad.mtime == os.path.getmtime(tf.name)
     assert ad.container_count == 0
     assert ad.container_list == []