From 1ca9426270b48708eff835c613e8db6adbc9e4e3 Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Tue, 15 Nov 2016 08:06:40 -0500 Subject: [PATCH] Remove in-place operation on User in unit test --- .../tests/unit/api/serializers/test_inventory_serializers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/awx/main/tests/unit/api/serializers/test_inventory_serializers.py b/awx/main/tests/unit/api/serializers/test_inventory_serializers.py index 0208105179..35f36a1100 100644 --- a/awx/main/tests/unit/api/serializers/test_inventory_serializers.py +++ b/awx/main/tests/unit/api/serializers/test_inventory_serializers.py @@ -28,12 +28,12 @@ class TestCustomInventoryScriptSerializer(object): (False, False, False, None))) def test_to_representation_orphan(self, superuser, sysaudit, admin_role, value): with mock.patch.object(CustomInventoryScriptSerializer, 'get_summary_fields', return_value={}): - User.add_to_class('is_system_auditor', sysaudit) + with mock.patch.object(User, 'is_system_auditor', return_value=sysaudit): user = User(username="root", is_superuser=superuser) roles = [user] if admin_role else [] with mock.patch('awx.main.models.CustomInventoryScript.admin_role', new_callable=PropertyMock, return_value=roles): - cis = CustomInventoryScript(pk=1, script='#!/python') + cis = CustomInventoryScript(pk=1, script=value) serializer = CustomInventoryScriptSerializer() factory = APIRequestFactory()