Skip to content

Commit

Permalink
fix: rename test variables
Browse files Browse the repository at this point in the history
  • Loading branch information
martinalbert committed Jun 6, 2024
1 parent 929c6fe commit 44a7538
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 73 deletions.
42 changes: 21 additions & 21 deletions butter_cms/tests/test_content_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down Expand Up @@ -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': {
Expand Down Expand Up @@ -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': {
Expand Down
36 changes: 18 additions & 18 deletions butter_cms/tests/test_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
40 changes: 20 additions & 20 deletions butter_cms/tests/test_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
28 changes: 14 additions & 14 deletions butter_cms/tests/test_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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",
Expand Down

0 comments on commit 44a7538

Please sign in to comment.