Ejemplo n.º 1
0
 def test_LoadSinglePacketMultipleBuildData_GetExactVersionWhenExactVersionIsPassed(self):
     test_listing = self.simulate_xml_load(self.get_single_packet_multiple_build_listing())
     self.assertFalse(test_listing.is_empty())
     package_1_0_0 = test_listing.get_package('SomePackage',
                                              version.parse_spec('v1.0-b0'))
     package_1_0_3 = test_listing.get_package('SomePackage',
                                              version.parse_spec('v1.0-b3'))
     self.assertNotEqual(package_1_0_0, None)
     self.assertNotEqual(package_1_0_3, None)
     self.assertEqual(package_1_0_0.get_version(),
                      version.parse_version('v1.0-b0'))
     self.assertEqual(package_1_0_3.get_version(),
                      version.parse_version('v1.0-b3'))
Ejemplo n.º 2
0
 def get_package(self, name, spec=version.parse_spec('*'), ignore_local_build=False, flavor='vanilla'):
     assert isinstance(spec, Spec)
     key = '%s@%s' % (name, flavor)
     if key in self.__packages:
         return self.__packages[key].get_entry(spec, ignore_local_build=ignore_local_build)
     else:
         return None
Ejemplo n.º 3
0
 def test_LoadExtensiveListing_TestIgnoringLocalBuilds(self):
     test_listing = self.simulate_xml_load(self.get_extensive_build_listing())
     package = test_listing.get_package('SomePackage',
                                        version.parse_spec('latest'),
                                        ignore_local_build=True)
     self.assertEqual(package.get_version(),
                      version.parse_version('v2.1-b2'))
Ejemplo n.º 4
0
 def check_package_retrieval(self, listing, package_name, requested_version, expected_version):
     package = listing.get_package(package_name, version.parse_spec(requested_version))
     self.assertNotEqual(package, None)
     self.assertEqual(package.get_name(), package_name)
     self.assertEqual(package.get_version(),
                      version.parse_version(expected_version),
                      'Expected to get %s - instead got %s' % (expected_version,
                                                               package.get_version()))
Ejemplo n.º 5
0
 def check_package_retrieval_with_flavor(self, listing, package_name, requested_version, flavor, expected_version):
     package = listing.get_package(package_name,
                                   version.parse_spec(requested_version),
                                   flavor=flavor)
     self.assertIsNotNone(package, 'Got None when retrieving %s %s %s' % (package_name, requested_version, flavor))
     self.assertEqual(package.get_name(), package_name)
     self.assertEqual(package.get_version(),
                      version.parse_version(expected_version),
                      'Expected to get %s - instead got %s' % (expected_version,
                                                               package.get_version()))
Ejemplo n.º 6
0
 def test_LoadSinglePacketMultipleBuildData_RequestNonexistentVersionGetNone(self):
     test_listing = self.simulate_xml_load(self.get_single_packet_multiple_build_listing())
     self.assertEqual(test_listing.get_package('SomePackage',
                                               version.parse_spec('v3.3-b3')), None)
Ejemplo n.º 7
0
 def test_LoadSinglePacketMultipleBuildData_GetLatestWhenUnspecifiedVersionIsPassed(self):
     test_listing = self.simulate_xml_load(self.get_single_packet_multiple_build_listing())
     package = test_listing.get_package('SomePackage',
                                        version.parse_spec('latest'))
     self.assertEqual(package.get_version(),
                      version.parse_version('v1.0-b3'))