From b5ad58e68c08d7ba19f7eb6db95a0fb1e1413733 Mon Sep 17 00:00:00 2001 From: Denys Zhdanov Date: Sun, 25 Aug 2024 22:12:05 +0200 Subject: [PATCH 1/4] Monkeypatching tagging --- webapp/graphite/events/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/webapp/graphite/events/models.py b/webapp/graphite/events/models.py index b00901ef9..3f8508171 100644 --- a/webapp/graphite/events/models.py +++ b/webapp/graphite/events/models.py @@ -7,6 +7,8 @@ import six django.utils.encoding.python_2_unicode_compatible = six.python_2_unicode_compatible django.utils.six = six +from django.utils.encoding import smart_str +django.utils.encoding.smart_text = smart_str from tagging.models import Tag # noqa: E402 from graphite.events.compat import ModelTaggedItemManager # noqa: E402 From 5a53384fdec982f3fa4985dc9a48d51c52ce464f Mon Sep 17 00:00:00 2001 From: Denys Zhdanov Date: Sun, 25 Aug 2024 22:31:19 +0200 Subject: [PATCH 2/4] taming linter --- webapp/graphite/events/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/graphite/events/models.py b/webapp/graphite/events/models.py index 3f8508171..c90408a58 100644 --- a/webapp/graphite/events/models.py +++ b/webapp/graphite/events/models.py @@ -1,13 +1,13 @@ import os from django.db import models +from django.utils.encoding import smart_str # Monkeypatching so that django-tagging can import python_2_unicode_compatible import django.utils.encoding import six django.utils.encoding.python_2_unicode_compatible = six.python_2_unicode_compatible django.utils.six = six -from django.utils.encoding import smart_str django.utils.encoding.smart_text = smart_str from tagging.models import Tag # noqa: E402 From ece41d8795f2819ab0ddea7166eb245a6a82ab64 Mon Sep 17 00:00:00 2001 From: Denys Zhdanov Date: Sun, 25 Aug 2024 22:36:30 +0200 Subject: [PATCH 3/4] did we fix tests? --- webapp/graphite/events/models.py | 2 +- webapp/tests/test_events.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/graphite/events/models.py b/webapp/graphite/events/models.py index c90408a58..e09b9c0a3 100644 --- a/webapp/graphite/events/models.py +++ b/webapp/graphite/events/models.py @@ -1,13 +1,13 @@ import os from django.db import models -from django.utils.encoding import smart_str # Monkeypatching so that django-tagging can import python_2_unicode_compatible import django.utils.encoding import six django.utils.encoding.python_2_unicode_compatible = six.python_2_unicode_compatible django.utils.six = six +from django.utils.encoding import smart_str # noqa: E402 django.utils.encoding.smart_text = smart_str from tagging.models import Tag # noqa: E402 diff --git a/webapp/tests/test_events.py b/webapp/tests/test_events.py index dce8891e6..2b8d86f98 100644 --- a/webapp/tests/test_events.py +++ b/webapp/tests/test_events.py @@ -231,8 +231,8 @@ def test_get_detail_json_object_does_not_exist(self): url = reverse('events_detail', args=[1]) response = self.client.get(url, {}, headers={"accept": 'application/json'}) self.assertEqual(response.status_code, 404) - #event = json.loads(response.content) - #self.assertEqual(event['error'], 'Event matching query does not exist') + event = json.loads(response.content) + self.assertEqual(event['error'], 'Event matching query does not exist') url = reverse('events_detail', args=[1]) response = self.client.get(url, {}) From ed1d8fb5a549f812d0b7f953862b491b13a720cf Mon Sep 17 00:00:00 2001 From: Denys Zhdanov Date: Sun, 25 Aug 2024 22:38:40 +0200 Subject: [PATCH 4/4] no, we don't --- webapp/tests/test_events.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/tests/test_events.py b/webapp/tests/test_events.py index 2b8d86f98..dce8891e6 100644 --- a/webapp/tests/test_events.py +++ b/webapp/tests/test_events.py @@ -231,8 +231,8 @@ def test_get_detail_json_object_does_not_exist(self): url = reverse('events_detail', args=[1]) response = self.client.get(url, {}, headers={"accept": 'application/json'}) self.assertEqual(response.status_code, 404) - event = json.loads(response.content) - self.assertEqual(event['error'], 'Event matching query does not exist') + #event = json.loads(response.content) + #self.assertEqual(event['error'], 'Event matching query does not exist') url = reverse('events_detail', args=[1]) response = self.client.get(url, {})