mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-13 15:58:41 -05:00
Merge pull request #7048 from AlanCoding/fix-7022
Act. stream Race condition avoidance with additional adjustments
This commit is contained in:
@@ -8,9 +8,18 @@ from awx.main.models import (
|
||||
Organization,
|
||||
JobTemplate,
|
||||
Credential,
|
||||
CredentialType
|
||||
CredentialType,
|
||||
InventorySource
|
||||
)
|
||||
|
||||
# other AWX
|
||||
from awx.main.utils import model_to_dict
|
||||
from awx.api.serializers import InventorySourceSerializer
|
||||
|
||||
|
||||
model_serializer_mapping = {
|
||||
InventorySource: InventorySourceSerializer
|
||||
}
|
||||
|
||||
|
||||
class TestImplicitRolesOmitted:
|
||||
@@ -140,3 +149,11 @@ class TestUserModels:
|
||||
entry = ActivityStream.objects.filter(user=alice)[0]
|
||||
assert entry.operation == 'create'
|
||||
assert json.loads(entry.changes)['password'] == 'hidden'
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_missing_related_on_delete(inventory_source):
|
||||
old_is = InventorySource.objects.get(name=inventory_source.name)
|
||||
inventory_source.inventory.delete()
|
||||
d = model_to_dict(old_is, serializer_mapping=model_serializer_mapping)
|
||||
assert d['inventory'] == '<missing inventory source>-{}'.format(old_is.inventory_id)
|
||||
|
||||
Reference in New Issue
Block a user