def test_validation_allows_any_uploaded_name_without_slash(self): name = factory.make_name('name') arch = '%s/%s' % ( factory.make_name('arch'), factory.make_name('subarch')) resource = BootResource( rtype=BOOT_RESOURCE_TYPE.UPLOADED, name=name, architecture=arch) resource.save()
def test_validation_allows_any_uploaded_name_slash_with_supported_os(self): osystem = factory.make_name('osystem') make_osystem(self, osystem) name = '%s/%s' % (osystem, factory.make_name('release')) arch = '%s/%s' % ( factory.make_name('arch'), factory.make_name('subarch')) resource = BootResource( rtype=BOOT_RESOURCE_TYPE.UPLOADED, name=name, architecture=arch) resource.save()
def test_validation_allows_any_uploaded_name_slash_with_supported_os(self): osystem = factory.make_name("osystem") make_osystem(self, osystem) name = "%s/%s" % (osystem, factory.make_name("release")) arch = "%s/%s" % ( factory.make_name("arch"), factory.make_name("subarch"), ) resource = BootResource( rtype=BOOT_RESOURCE_TYPE.UPLOADED, name=name, architecture=arch ) resource.save()
def test_validation_allows_any_uploaded_name_slash_with_supported_os(self): osystem = factory.make_name('osystem') self.patch(osystems, 'gen_all_known_operating_systems').return_value = [{ 'name': osystem }] name = '%s/%s' % (osystem, factory.make_name('release')) arch = '%s/%s' % (factory.make_name('arch'), factory.make_name('subarch')) resource = BootResource(rtype=BOOT_RESOURCE_TYPE.UPLOADED, name=name, architecture=arch) resource.save()
def test_validation_raises_error_on_invalid_name_for_uploaded(self): name = '%s/%s' % (factory.make_name('os'), factory.make_name('series')) arch = '%s/%s' % (factory.make_name('arch'), factory.make_name('subarch')) resource = BootResource(rtype=BOOT_RESOURCE_TYPE.UPLOADED, name=name, architecture=arch) self.assertRaises(ValidationError, resource.save)
def test_validation_raises_error_on_invalid_name_for_generated(self): name = factory.make_name('name') arch = '%s/%s' % (factory.make_name('arch'), factory.make_name('subarch')) resource = BootResource(rtype=BOOT_RESOURCE_TYPE.GENERATED, name=name, architecture=arch) self.assertRaises(ValidationError, resource.save)
def test_validation_raises_error_on_invalid_name_for_synced(self): name = factory.make_name("name") arch = "%s/%s" % ( factory.make_name("arch"), factory.make_name("subarch"), ) resource = BootResource( rtype=BOOT_RESOURCE_TYPE.SYNCED, name=name, architecture=arch ) self.assertRaises(ValidationError, resource.save)
def test_display_rtype(self): for key, value in BOOT_RESOURCE_TYPE_CHOICES_DICT.items(): resource = BootResource(rtype=key) self.assertEqual(value, resource.display_rtype)