From 44a75388ac65d8942f56457f61311e0fb576b18e Mon Sep 17 00:00:00 2001 From: Martin Albert Date: Thu, 6 Jun 2024 19:00:29 +0200 Subject: [PATCH] fix: rename test variables --- butter_cms/tests/test_content_field.py | 42 +++++++++++++------------- butter_cms/tests/test_page.py | 36 +++++++++++----------- butter_cms/tests/test_post.py | 40 ++++++++++++------------ butter_cms/tests/test_tag.py | 28 ++++++++--------- 4 files changed, 73 insertions(+), 73 deletions(-) diff --git a/butter_cms/tests/test_content_field.py b/butter_cms/tests/test_content_field.py index cfb3008..fddad99 100644 --- a/butter_cms/tests/test_content_field.py +++ b/butter_cms/tests/test_content_field.py @@ -32,18 +32,18 @@ def test_list_filtered_content_fields(self): self.assertIsNotNone(response) self.assertIn('data', response) - data = response['data'] - self.assertIsNotNone(data) - self.assertIn('navigation_menu', data) - self.assertIn('navigation_menu_item', data) + content_fields = response['data'] + self.assertIsNotNone(content_fields) + self.assertIn('navigation_menu', content_fields) + self.assertIn('navigation_menu_item', content_fields) - k1 = data['navigation_menu'] - self.assertEqual(len(k1), 1) + navigation_menu_field = content_fields['navigation_menu'] + self.assertEqual(len(navigation_menu_field), 1) - k2 = data['navigation_menu_item'] - self.assertGreater(len(k2), 1) + navigation_menu_item_field = content_fields['navigation_menu_item'] + self.assertGreater(len(navigation_menu_item_field), 1) self.assertEqual( - k2, + navigation_menu_item_field, [ { 'meta': { @@ -118,14 +118,14 @@ def test_get_content_field_without_filtering(self): self.assertIsNotNone(response) self.assertIn('data', response) - data = response['data'] - self.assertIsNotNone(data) - self.assertIn('navigation_menu_item', data) + content_fields = response['data'] + self.assertIsNotNone(content_fields) + self.assertIn('navigation_menu_item', content_fields) - f = data['navigation_menu_item'] - self.assertGreater(len(f), 1) + navigation_menu_item_field = content_fields['navigation_menu_item'] + self.assertGreater(len(navigation_menu_item_field), 1) self.assertEqual( - f, + navigation_menu_item_field, [ { 'meta': { @@ -180,14 +180,14 @@ def test_get_filtered_content_field(self): self.assertIsNotNone(response) self.assertIn('data', response) - data = response['data'] - self.assertIsNotNone(data) - self.assertIn('navigation_menu_item', data) + content_fields = response['data'] + self.assertIsNotNone(content_fields) + self.assertIn('navigation_menu_item', content_fields) - f = data['navigation_menu_item'] - self.assertEqual(1, len(f)) + navigation_menu_item_field = content_fields['navigation_menu_item'] + self.assertEqual(1, len(navigation_menu_item_field)) self.assertEqual( - f, + navigation_menu_item_field, [ { 'meta': { diff --git a/butter_cms/tests/test_page.py b/butter_cms/tests/test_page.py index e2890da..8656f2c 100644 --- a/butter_cms/tests/test_page.py +++ b/butter_cms/tests/test_page.py @@ -24,14 +24,14 @@ def test_list_pages(self): self.assertIsNotNone(response) self.assertIn('data', response) - data = response['data'] - self.assertIsNotNone(data) - self.assertIsInstance(data, list) - self.assertGreater(len(data), 0) + pages = response['data'] + self.assertIsNotNone(pages) + self.assertIsInstance(pages, list) + self.assertGreater(len(pages), 0) - d1 = data[0] + page_1 = pages[0] self.assertEqual( - d1, + page_1, { "slug": "landing-page-with-components", "name": "Landing Page with Components", @@ -146,14 +146,14 @@ def test_list_pages_without_page_type(self): self.assertIsNotNone(response) self.assertIn('data', response) - data = response['data'] - self.assertIsNotNone(data) - self.assertIsInstance(data, list) - self.assertEqual(1, len(data)) + pages = response['data'] + self.assertIsNotNone(pages) + self.assertIsInstance(pages, list) + self.assertEqual(1, len(pages)) - d1 = data[0] + page_1 = pages[0] self.assertEqual( - d1, + page_1, { "slug": "simple-page", "name": "Simple Page", @@ -334,14 +334,14 @@ def test_search_page(self): self.assertIsNotNone(response) self.assertIn('data', response) - data = response['data'] - self.assertIsNotNone(data) - self.assertIsInstance(data, list) - self.assertEqual(1, len(data)) + pages = response['data'] + self.assertIsNotNone(pages) + self.assertIsInstance(pages, list) + self.assertEqual(1, len(pages)) - d1 = data[0] + page_1 = pages[0] self.assertEqual( - d1, + page_1, { "slug": "landing-page-with-components", "name": "Landing Page with Components", diff --git a/butter_cms/tests/test_post.py b/butter_cms/tests/test_post.py index ce3f3fc..12b4878 100644 --- a/butter_cms/tests/test_post.py +++ b/butter_cms/tests/test_post.py @@ -24,14 +24,14 @@ def test_list_posts(self): self.assertIsNotNone(response) self.assertIn('data', response) - data = response['data'] - self.assertIsNotNone(data) - self.assertIsInstance(data, list) - self.assertGreater(len(data), 0) + posts = response['data'] + self.assertIsNotNone(posts) + self.assertIsInstance(posts, list) + self.assertGreater(len(posts), 0) - d1 = data[0] + post_1 = posts[0] self.assertEqual( - d1, + post_1, { "status": "published", "created": "2024-05-17T14:13:46.787544Z", @@ -83,14 +83,14 @@ def test_list_posts_without_body(self): self.assertIsNotNone(response) self.assertIn('data', response) - data = response['data'] - self.assertIsNotNone(data) - self.assertIsInstance(data, list) - self.assertGreater(len(data), 0) + posts = response['data'] + self.assertIsNotNone(posts) + self.assertIsInstance(posts, list) + self.assertGreater(len(posts), 0) - d1 = data[0] + post_1 = posts[0] self.assertEqual( - d1, + post_1, { "status": "published", "created": "2024-05-17T14:13:46.787544Z", @@ -229,19 +229,19 @@ def test_search_post(self): self.assertIsNotNone(response) self.assertIn('data', response) - data = response['data'] - self.assertIsNotNone(data) - self.assertIsInstance(data, list) - self.assertGreater(len(data), 0) + posts = response['data'] + self.assertIsNotNone(posts) + self.assertIsInstance(posts, list) + self.assertGreater(len(posts), 0) - d1 = data[0] - self.assertIn('body', d1) + post_1 = posts[0] + self.assertIn('body', post_1) - body = d1['body'] + body = post_1['body'] self.assertIn(query, body) self.assertEqual( - d1, + post_1, { "created": "2024-05-17T14:13:46.787544Z", "published": "2024-05-17T14:13:46.787109Z", diff --git a/butter_cms/tests/test_tag.py b/butter_cms/tests/test_tag.py index 3f40f77..df8bc0e 100644 --- a/butter_cms/tests/test_tag.py +++ b/butter_cms/tests/test_tag.py @@ -24,15 +24,15 @@ def test_list_tags(self): self.assertIsNotNone(response) self.assertIn('data', response) - data = response['data'] - self.assertIsNotNone(data) - self.assertIsInstance(data, list) - self.assertGreater(len(data), 0) + tags = response['data'] + self.assertIsNotNone(tags) + self.assertIsInstance(tags, list) + self.assertGreater(len(tags), 0) - d1 = data[0] - self.assertNotIn('recent_posts', d1) + tag_1 = tags[0] + self.assertNotIn('recent_posts', tag_1) self.assertEqual( - d1, + tag_1, { 'name': 'Example Tag', 'slug': 'example-tag', @@ -47,15 +47,15 @@ def test_list_tags_with_recent_posts(self): self.assertIsNotNone(response) self.assertIn('data', response) - data = response['data'] - self.assertIsNotNone(data) - self.assertIsInstance(data, list) - self.assertGreater(len(data), 0) + tags = response['data'] + self.assertIsNotNone(tags) + self.assertIsInstance(tags, list) + self.assertGreater(len(tags), 0) - d1 = data[0] - self.assertIn('recent_posts', d1) + tag_1 = tags[0] + self.assertIn('recent_posts', tag_1) self.assertEqual( - d1, + tag_1, { "name": "Example Tag", "slug": "example-tag",