def test_link_artifact_to_current(self): """ Create a link in the parent directory for this artifact, pointing to the directory of the artifact, with the name "current". """ transport = LocalTransport(self.archive) fakefile = StringIO("This is the artifact") transport.archive_file(fakefile, "/temp/temp.gz") current_dir = transport.link_to_current("/temp/temp.gz") self.assertEqual(os.path.join(self.basedir, "current"), current_dir) self.assertTrue(os.path.islink(current_dir), "current is not a symlink") self.assertEqual( os.path.dirname(transport.get_relative_filename("/temp/temp.gz")), os.path.realpath(current_dir))
def test_link_artifact_to_current(self): """ Create a link in the parent directory for this artifact, pointing to the directory of the artifact, with the name "current". """ transport = LocalTransport(self.archive) fakefile = StringIO("This is the artifact") transport.archive_file(fakefile, "/temp/temp.gz") current_dir = transport.link_to_current("/temp/temp.gz") self.assertEqual(os.path.join(self.basedir, "current"), current_dir) self.assertTrue( os.path.islink(current_dir), "current is not a symlink") self.assertEqual( os.path.dirname(transport.get_relative_filename("/temp/temp.gz")), os.path.realpath(current_dir))
def test_link_artifact_to_current_replaces_existing_current(self): """ If we run link_artifact_to_current with a new path, it should ensure that the "current" directory is the new one. """ transport = LocalTransport(self.archive) fakefile = StringIO("This is the artifact") transport.archive_file(fakefile, "/temp1/temp.gz") transport.link_to_current("/temp1/temp.gz") fakefile = StringIO("Another artifact") transport.archive_file(fakefile, "/temp2/temp.gz") current_dir = transport.link_to_current("/temp2/temp.gz") self.assertEqual( os.path.dirname(transport.get_relative_filename("/temp2/temp.gz")), os.path.realpath(current_dir))