def test_normalize_license(self): self.assertEqual(normalize_license(None), "UNKNOWN") self.assertEqual( normalize_license("""License :: OSI Approved :: MIT License """), "License :: OSI Approved :: MIT License") self.assertEqual(normalize_license("Pow" * 80), "Custom") self.assertEqual(normalize_license("MIT"), "MIT")
def test_normalize_license(self): self.assertEqual(normalize_license(None), "UNKNOWN") self.assertEqual( normalize_license("""License :: OSI Approved :: MIT License"""), "License :: OSI Approved :: MIT License" ) self.assertEqual(normalize_license("Pow" * 80), "Custom") self.assertEqual(normalize_license("MIT"), "MIT")
def save(self, *args, **kwargs): self.license = normalize_license(self.license) # reset the latest_version cache on the package cache_name = self.package.cache_namer(self.package.last_released) cache.delete(cache_name) get_version(self.package) # reset the pypi_version cache on the package cache_name = self.package.cache_namer(self.package.pypi_version) cache.delete(cache_name) get_pypi_version(self.package) super(Version, self).save(*args, **kwargs)
def save(self, *args, **kwargs): self.license = normalize_license(self.license) super(Version, self).save(*args, **kwargs)