'Should not be possible to delete a Software Component Arch that
is referenced by an existing Software Component'

def test_delete_reference(self):

    kind = models.SoftwareComponentKind.objects.create(name='rpm')
    kind.save()
    kind_id = kind.id
    arch = models.SoftwareComponentArch.objects.create(name='x86_64')
    arch.save()
    arch_id = arch.id
    sc = models.SoftwareComponent.objects.create(name='foo', kind=kind, arch=arch, version='1.0.0')
    sc.save()
    sc_id = sc.id
    sc = models.SoftwareComponent.objects.get(pk=sc_id)
    arch = models.SoftwareComponentArch.objects.get(pk=arch_id)
    def arch_delete():
        arch.delete()
    self.assertRaises(dbmodels.ProtectedError, arch_delete)
    models.SoftwareComponent.objects.all().delete()
    models.SoftwareComponentKind.objects.all().delete()
    models.SoftwareComponentArch.objects.all().delete()
