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'))
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'))
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()))
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()))
def add_package(self, name, version_string, flavor='vanilla'): key = '%s@%s' % (name, flavor) if not key in self.__packages: self.__packages[key] = PackageInfo(name, self.__root, flavor) return self.__packages[key].add_build(version.parse_version(version_string))
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'))
def test_LoadSinglePacketData_PacketCanBeAccessed(self): test_listing = self.simulate_xml_load(self.get_single_packet_listing()) self.assertFalse(test_listing.is_empty()) package = test_listing.get_package('SomePackage') self.assertEqual(package.get_version(), version.parse_version('v1.0-b0'))