def test_get_environment_metadata(self): # Verify that metadata is generated directory = tempfile.mkdtemp() self.directories['local'] = directory local_path = os.path.join(directory, "local") client = TarClient(local_path) self.assertTrue('version' in client.get_environment_metadata())
def test_checkout_dir_exists(self): directory = tempfile.mkdtemp() self.directories["checkout_test"] = directory local_path = os.path.join(directory, "exploration") client = TarClient(local_path) self.assertFalse(client.path_exists()) os.makedirs(local_path) self.assertTrue(client.checkout(self.remote_url)) # non-empty self.assertFalse(client.checkout(self.remote_url))
def test_get_url_by_reading(self): directory = tempfile.mkdtemp() self.directories['local'] = directory local_path = os.path.join(directory, "local") client = TarClient(local_path) self.assertTrue(client.checkout(self.remote_url, self.package_version)) self.assertTrue(client.path_exists()) self.assertTrue(client.detect_presence()) self.assertEqual(client.get_url(), self.remote_url)
def test_get_url_by_reading(self): directory = tempfile.mkdtemp() self.directories['local'] = directory remote_url = "https://code.ros.org/svn/release/download/stacks/exploration/exploration-0.3.0/exploration-0.3.0.tar.bz2" local_version = "exploration-0.3.0" local_path = os.path.join(directory, "local") client = TarClient(local_path) self.assertTrue(client.checkout(remote_url, local_version)) self.assertTrue(client.path_exists()) self.assertTrue(client.detect_presence()) self.assertEqual(client.get_url(), remote_url)
def test_get_url_by_reading(self): from vcstools.tar import TarClient directory = tempfile.mkdtemp() self.directories['readonly'] = directory readonly_url = "https://code.ros.org/svn/release/download/stacks/exploration/exploration-0.3.0/exploration-0.3.0.tar.bz2" readonly_version = "exploration-0.3.0" readonly_path = os.path.join(directory, "readonly") client = TarClient(readonly_path) self.assertTrue(client.checkout(readonly_url, readonly_version)) self.assertTrue(client.path_exists()) self.assertTrue(client.detect_presence()) self.assertEqual(client.get_url(), readonly_url)
def test_checkout_version(self): directory = tempfile.mkdtemp() self.directories["checkout_test"] = directory local_path = os.path.join(directory, "exploration") client = TarClient(local_path) self.assertFalse(client.path_exists()) self.assertFalse(client.detect_presence()) self.assertFalse(client.detect_presence()) self.assertTrue(client.checkout(self.remote_url, version=self.package_version)) self.assertTrue(client.path_exists()) self.assertTrue(client.detect_presence()) self.assertEqual(client.get_path(), local_path) self.assertEqual(client.get_url(), self.remote_url) # make sure the tarball subdirectory was promoted correctly. self.assertTrue(os.path.exists(os.path.join(local_path, 'package.xml')))
def test_checkout_version_compressed_local(self): directory = tempfile.mkdtemp() self.directories["checkout_test"] = directory local_path = os.path.join(directory, "version1") url = self.tar_url_compressed client = TarClient(local_path) self.assertFalse(client.path_exists()) self.assertFalse(client.detect_presence()) self.assertFalse(client.detect_presence()) self.assertTrue(client.checkout(url, version='version1')) self.assertTrue(client.path_exists()) self.assertTrue(client.detect_presence()) self.assertEqual(client.get_path(), local_path) self.assertEqual(client.get_url(), url) # make sure the tarball subdirectory was promoted correctly. self.assertTrue(os.path.exists(os.path.join(local_path, 'stack.xml')))
def test_checkout_version(self): directory = tempfile.mkdtemp() self.directories["checkout_test"] = directory local_path = os.path.join(directory, "exploration") url = "https://code.ros.org/svn/release/download/stacks/exploration/exploration-0.3.0/exploration-0.3.0.tar.bz2" client = TarClient(local_path) self.assertFalse(client.path_exists()) self.assertFalse(client.detect_presence()) self.assertFalse(client.detect_presence()) self.assertTrue(client.checkout(url, version='exploration-0.3.0')) self.assertTrue(client.path_exists()) self.assertTrue(client.detect_presence()) self.assertEqual(client.get_path(), local_path) self.assertEqual(client.get_url(), url) self.assertTrue(os.path.exists(os.path.join(local_path, 'stack.xml'))) #make sure the tarball subdirectory was promoted correctly.
def test_checkout_version(self): directory = tempfile.mkdtemp() self.directories["checkout_test"] = directory local_path = os.path.join(directory, "exploration") client = TarClient(local_path) self.assertFalse(client.path_exists()) self.assertFalse(client.detect_presence()) self.assertFalse(client.detect_presence()) self.assertTrue(client.checkout(self.remote_url, version=self.package_version)) self.assertTrue(client.path_exists()) self.assertTrue(client.detect_presence()) self.assertEqual(client.get_path(), local_path) self.assertEqual(client.get_url(), self.remote_url) # make sure the tarball subdirectory was promoted correctly. self.assertTrue(os.path.exists(os.path.join(local_path, "stack.xml")))
def test_checkout_version_compressed_local(self): directory = tempfile.mkdtemp() self.directories["checkout_test"] = directory local_path = os.path.join(directory, "version1") url = self.tar_url_compressed client = TarClient(local_path) self.assertFalse(client.path_exists()) self.assertFalse(client.detect_presence()) self.assertFalse(client.detect_presence()) self.assertTrue(client.checkout(url, version='version1')) self.assertTrue(client.path_exists()) self.assertTrue(client.detect_presence()) self.assertEqual(client.get_path(), local_path) self.assertEqual(client.get_url(), url) self.assertTrue(os.path.exists(os.path.join(local_path, 'stack.xml'))) #make sure the tarball subdirectory was promoted correctly.
def test_checkout(self): from vcstools.tar import TarClient directory = tempfile.mkdtemp() self.directories["checkout_test"] = directory local_path = os.path.join(directory, "exploration") url = "https://code.ros.org/svn/release/download/stacks/exploration/exploration-0.3.0/exploration-0.3.0.tar.bz2" client = TarClient(local_path) self.assertFalse(client.path_exists()) self.assertFalse(client.detect_presence()) self.assertFalse(client.detect_presence()) self.assertTrue(client.checkout(url)) self.assertTrue(client.path_exists()) self.assertTrue(client.detect_presence()) self.assertEqual(client.get_path(), local_path) self.assertEqual(client.get_url(), url) #self.assertEqual(client.get_version(), '-r*') shutil.rmtree(directory) self.directories.pop("checkout_test")
def check_checkout(self, query_params): # checks out all subdirs directory = tempfile.mkdtemp() self.directories["checkout_test"] = directory local_path = os.path.join(directory, "exploration") client = TarClient(local_path) self.assertFalse(client.path_exists()) self.assertFalse(client.detect_presence()) self.assertFalse(client.detect_presence()) self.assertTrue(client.checkout(self.remote_url + query_params)) self.assertTrue(client.path_exists()) self.assertTrue(client.detect_presence()) self.assertEqual(client.get_path(), local_path) self.assertEqual(client.get_url(), self.remote_url + query_params) # make sure the tarball subdirectory was promoted correctly. self.assertTrue(os.path.exists(os.path.join(local_path, self.package_version, 'package.xml')))
def test_get_url_nonexistant(self): from vcstools.tar import TarClient local_path = "/tmp/dummy" client = TarClient(local_path) self.assertEqual(client.get_url(), None)
def test_get_type_name(self): from vcstools.tar import TarClient local_path = "/tmp/dummy" client = TarClient(local_path) self.assertEqual(client.get_vcs_type_name(), 'tar')
def test_get_type_name(self): local_path = "/tmp/dummy" client = TarClient(local_path) self.assertEqual(client.get_vcs_type_name(), 'tar')
def test_get_url_nonexistant(self): local_path = "/tmp/dummy" client = TarClient(local_path) self.assertEqual(client.get_url(), None)