Example #1
0
 def test__get_image_download_in_progress(self):
     def _create_instance_path(*args):
         open(master_path, 'w').close()
         return True
     temp_dir = tempfile.mkdtemp()
     instance_path = os.path.join(temp_dir, 'instance_path')
     fileutils.ensure_tree(temp_dir)
     master_uuid = 'instance_uuid'
     master_path = os.path.join(temp_dir, master_uuid)
     lock_file = os.path.join(temp_dir, 'instance_uuid.lock')
     self.mox.StubOutWithMock(pxe, '_download_in_progress')
     pxe._download_in_progress(lock_file).\
         WithSideEffects(_create_instance_path).\
         AndReturn(True)
     self.mox.ReplayAll()
     pxe._get_image(None, instance_path, master_uuid, temp_dir)
     self.mox.VerifyAll()
     self.assertTrue(os.path.exists(instance_path))
Example #2
0
 def test__download_in_progress(self):
     temp_dir = tempfile.mkdtemp()
     lock_file = os.path.join(temp_dir, 'lock_file')
     self.assertFalse(pxe._download_in_progress(lock_file))
     self.assertTrue(os.path.exists(lock_file))
Example #3
0
 def test__download_in_progress(self):
     temp_dir = tempfile.mkdtemp()
     lock_file = os.path.join(temp_dir, 'lock_file')
     self.assertFalse(pxe._download_in_progress(lock_file))
     self.assertTrue(os.path.exists(lock_file))