From 2972827b7f8a80f706f95f035c197dc10d9c714e Mon Sep 17 00:00:00 2001
From: Martin Albert Welcome to ButterCMS! This an example blog post written using Butter. Here's a helpful walkthrough of our Blog Engine solution. \\n\\n\\nBlog Engine Demo
\\n
https://buttercms.com/demo/blog-engine-why-our-blog-engine/
If you're viewing this post from your website or command line, you've successfully made a request to the Butter API. If you haven't already, make sure you have our development guides pulled up for step-by-step instructions on setting up Butter.
\\nButter's WYSIWYG editor supports standard text formatting including headings, links, quotes, code, text alignment, and more. You can upload, crop, and resize images which are automatically hosted and delivered through a CDN (see below). You can also edit HTML directly when needed.
\\nYes. Butter can be used as a full CMS for managing dynamic content and creating pages across your entire website or app. Check out our development guides for step-by-step tutorials on setting this up.
\\n\",\"summary\":\"This is an example blog post. Pretty neat huh?\",\"updated\":\"2024-05-17T14:13:46.813008Z\",\"deleted\":null,\"seo_title\":\"Example Post SEO Optimized Title\",\"meta_description\":\"This is our example blog posts SEO optimized meta description.\",\"status\":\"published\"}]},{\"first_name\":\"John\",\"last_name\":\"Doe\",\"email\":\"\",\"slug\":\"john-doe\",\"bio\":\"Bio of test user\",\"title\":\"Test\",\"linkedin_url\":\"\",\"facebook_url\":\"\",\"instagram_url\":\"\",\"pinterest_url\":\"\",\"twitter_handle\":\"\",\"profile_image\":\"\",\"recent_posts\":[]}]}", + "object": { + "data": [ + { + "first_name": "SDK", + "last_name": "Tests", + "email": "sdktests@buttercms.com", + "slug": "sdk-tests", + "bio": "", + "title": "", + "linkedin_url": "", + "facebook_url": "", + "instagram_url": "", + "pinterest_url": "", + "twitter_handle": "", + "profile_image": "", + "recent_posts": [ + { + "created": "2024-05-17T14:13:46.787544Z", + "published": "2024-05-17T14:13:46.787109Z", + "url": null, + "slug": "example-post", + "featured_image": "https://cdn.buttercms.com/WUkiXJ6RCqZmjR8xihEL", + "featured_image_alt": "", + "author": { + "first_name": "SDK", + "last_name": "Tests", + "email": "sdktests@buttercms.com", + "slug": "sdk-tests", + "bio": "", + "title": "", + "linkedin_url": "", + "facebook_url": "", + "instagram_url": "", + "pinterest_url": "", + "twitter_handle": "", + "profile_image": "" + }, + "tags": [ + { + "name": "Example Tag", + "slug": "example-tag" + } + ], + "categories": [ + { + "name": "Example Category", + "slug": "example-category" + } + ], + "title": "Example Post", + "body": "Welcome to ButterCMS! This an example blog post written using Butter.
\nHere's a helpful walkthrough of our Blog Engine solution.
\n\n\n\n
If you're viewing this post from your website or command line, you've successfully made a request to the Butter API. If you haven't already, make sure you have our development guides pulled up for step-by-step instructions on setting up Butter.
\nButter's WYSIWYG editor supports standard text formatting including headings, links, quotes, code, text alignment, and more. You can upload, crop, and resize images which are automatically hosted and delivered through a CDN (see below). You can also edit HTML directly when needed.
\nYes. Butter can be used as a full CMS for managing dynamic content and creating pages across your entire website or app. Check out our development guides for step-by-step tutorials on setting this up.
\n", + "summary": "This is an example blog post. Pretty neat huh?", + "updated": "2024-05-17T14:13:46.813008Z", + "deleted": null, + "seo_title": "Example Post SEO Optimized Title", + "meta_description": "This is our example blog posts SEO optimized meta description.", + "status": "published" + } + ] + }, + { + "first_name": "John", + "last_name": "Doe", + "email": "", + "slug": "john-doe", + "bio": "Bio of test user", + "title": "Test", + "linkedin_url": "", + "facebook_url": "", + "instagram_url": "", + "pinterest_url": "", + "twitter_handle": "", + "profile_image": "", + "recent_posts": [] + } + ] + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/test_author_all.json b/butter_cms/tests/fixtures/authors/test_author_get.json similarity index 74% rename from butter_cms/tests/fixtures/test_author_all.json rename to butter_cms/tests/fixtures/authors/test_author_get.json index a86a052..f67225a 100644 --- a/butter_cms/tests/fixtures/test_author_all.json +++ b/butter_cms/tests/fixtures/authors/test_author_get.json @@ -4,7 +4,7 @@ { "request": { "method": "GET", - "uri": "https://api.buttercms.com/v2/authors/", + "uri": "https://api.buttercms.com/v2/authors/sdk-tests", "body": null, "headers": { "User-Agent": [ @@ -30,70 +30,71 @@ "message": "OK" }, "headers": { - "X-Frame-Options": [ - "DENY" + "Content-Type": [ + "application/json" ], "Allow": [ "GET, HEAD, OPTIONS" ], + "X-Frame-Options": [ + "DENY" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "content-length": [ + "234" + ], "Access-Control-Allow-Origin": [ "*" ], - "Connection": [ - "keep-alive" + "Server": [ + "gunicorn/19.9.0" + ], + "X-Timer": [ + "S1716209387.651152,VS0,VE2" + ], + "Referrer-Policy": [ + "same-origin" ], "Accept-Ranges": [ "bytes" ], - "X-Content-Type-Options": [ - "nosniff" - ], - "Content-Type": [ - "application/json" + "X-Cache": [ + "MISS, HIT" ], "X-Cache-Hits": [ - "0, 0" + "0, 1" ], - "content-length": [ - "1557" + "Date": [ + "Mon, 20 May 2024 12:49:46 GMT" ], - "X-Timer": [ - "S1715769669.875015,VS0,VE1" + "Connection": [ + "keep-alive" ], "X-Served-By": [ - "cache-iad-kiad7000178-IAD, cache-vie6373-VIE" + "cache-iad-kjyo7100025-IAD, cache-vie6321-VIE" ], "Vary": [ "Origin, Accept-Encoding" ], - "Date": [ - "Wed, 15 May 2024 10:41:08 GMT" - ], "Via": [ "1.1 vegur, 1.1 varnish, 1.1 varnish" ], - "X-Cache": [ - "MISS, HIT" - ], "Age": [ - "73107" - ], - "Referrer-Policy": [ - "same-origin" - ], - "Server": [ - "gunicorn/19.9.0" + "41" ] }, "body": { - "data": [ - { - "first_name": "Martin", - "last_name": "Albert", - "email": "martin.albert@applifting.cz", - "slug": "martin-albert", + "string": "{\"data\":{\"first_name\":\"SDK\",\"last_name\":\"Tests\",\"email\":\"sdktests@buttercms.com\",\"slug\":\"sdk-tests\",\"bio\":\"\",\"title\":\"\",\"linkedin_url\":\"\",\"facebook_url\":\"\",\"instagram_url\":\"\",\"pinterest_url\":\"\",\"twitter_handle\":\"\",\"profile_image\":\"\"}}", + "object": { + "data": { + "first_name": "SDK", + "last_name": "Tests", + "email": "sdktests@buttercms.com", + "slug": "sdk-tests", "bio": "", - "title": "Backend Developer", + "title": "", "linkedin_url": "", "facebook_url": "", "instagram_url": "", @@ -101,7 +102,7 @@ "twitter_handle": "", "profile_image": "" } - ] + } } } } diff --git a/butter_cms/tests/fixtures/authors/test_author_get_invalid_token.json b/butter_cms/tests/fixtures/authors/test_author_get_invalid_token.json new file mode 100644 index 0000000..abbfc56 --- /dev/null +++ b/butter_cms/tests/fixtures/authors/test_author_get_invalid_token.json @@ -0,0 +1,97 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/authors/sdk-tests", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 401, + "message": "Unauthorized" + }, + "headers": { + "Content-Type": [ + "application/json" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "X-Frame-Options": [ + "DENY" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Content-Length": [ + "27" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "X-Timer": [ + "S1716209387.763832,VS0,VE555" + ], + "Referrer-Policy": [ + "same-origin" + ], + "Www-Authenticate": [ + "Token" + ], + "Accept-Ranges": [ + "bytes" + ], + "X-Cache": [ + "MISS, MISS" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Date": [ + "Mon, 20 May 2024 12:49:47 GMT" + ], + "Connection": [ + "keep-alive" + ], + "X-Served-By": [ + "cache-iad-kcgs7200144-IAD, cache-vie6324-VIE" + ], + "Vary": [ + "Origin" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ] + }, + "body": { + "string": "{\"detail\":\"Invalid token.\"}", + "object": { + "detail": "Invalid token." + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/authors/test_author_get_with_posts.json b/butter_cms/tests/fixtures/authors/test_author_get_with_posts.json new file mode 100644 index 0000000..fa46506 --- /dev/null +++ b/butter_cms/tests/fixtures/authors/test_author_get_with_posts.json @@ -0,0 +1,154 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/authors/sdk-tests?include=recent_posts", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "X-Frame-Options": [ + "DENY" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "content-length": [ + "3351" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "X-Timer": [ + "S1716209387.711750,VS0,VE1" + ], + "Referrer-Policy": [ + "same-origin" + ], + "Accept-Ranges": [ + "bytes" + ], + "X-Cache": [ + "MISS, HIT" + ], + "X-Cache-Hits": [ + "0, 1" + ], + "Date": [ + "Mon, 20 May 2024 12:49:46 GMT" + ], + "Connection": [ + "keep-alive" + ], + "X-Served-By": [ + "cache-iad-kiad7000133-IAD, cache-vie6366-VIE" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Age": [ + "41" + ] + }, + "body": { + "string": "{\"data\":{\"first_name\":\"SDK\",\"last_name\":\"Tests\",\"email\":\"sdktests@buttercms.com\",\"slug\":\"sdk-tests\",\"bio\":\"\",\"title\":\"\",\"linkedin_url\":\"\",\"facebook_url\":\"\",\"instagram_url\":\"\",\"pinterest_url\":\"\",\"twitter_handle\":\"\",\"profile_image\":\"\",\"recent_posts\":[{\"created\":\"2024-05-17T14:13:46.787544Z\",\"published\":\"2024-05-17T14:13:46.787109Z\",\"url\":null,\"slug\":\"example-post\",\"featured_image\":\"https://cdn.buttercms.com/WUkiXJ6RCqZmjR8xihEL\",\"featured_image_alt\":\"\",\"author\":{\"first_name\":\"SDK\",\"last_name\":\"Tests\",\"email\":\"sdktests@buttercms.com\",\"slug\":\"sdk-tests\",\"bio\":\"\",\"title\":\"\",\"linkedin_url\":\"\",\"facebook_url\":\"\",\"instagram_url\":\"\",\"pinterest_url\":\"\",\"twitter_handle\":\"\",\"profile_image\":\"\"},\"tags\":[{\"name\":\"Example Tag\",\"slug\":\"example-tag\"}],\"categories\":[{\"name\":\"Example Category\",\"slug\":\"example-category\"}],\"title\":\"Example Post\",\"body\":\"Welcome to ButterCMS! This an example blog post written using Butter.
\\nHere's a helpful walkthrough of our Blog Engine solution.
\\n\\n\\n\\n
If you're viewing this post from your website or command line, you've successfully made a request to the Butter API. If you haven't already, make sure you have our development guides pulled up for step-by-step instructions on setting up Butter.
\\nButter's WYSIWYG editor supports standard text formatting including headings, links, quotes, code, text alignment, and more. You can upload, crop, and resize images which are automatically hosted and delivered through a CDN (see below). You can also edit HTML directly when needed.
\\nYes. Butter can be used as a full CMS for managing dynamic content and creating pages across your entire website or app. Check out our development guides for step-by-step tutorials on setting this up.
\\n\",\"summary\":\"This is an example blog post. Pretty neat huh?\",\"updated\":\"2024-05-17T14:13:46.813008Z\",\"deleted\":null,\"seo_title\":\"Example Post SEO Optimized Title\",\"meta_description\":\"This is our example blog posts SEO optimized meta description.\",\"status\":\"published\"}]}}", + "object": { + "data": { + "first_name": "SDK", + "last_name": "Tests", + "email": "sdktests@buttercms.com", + "slug": "sdk-tests", + "bio": "", + "title": "", + "linkedin_url": "", + "facebook_url": "", + "instagram_url": "", + "pinterest_url": "", + "twitter_handle": "", + "profile_image": "", + "recent_posts": [ + { + "created": "2024-05-17T14:13:46.787544Z", + "published": "2024-05-17T14:13:46.787109Z", + "url": null, + "slug": "example-post", + "featured_image": "https://cdn.buttercms.com/WUkiXJ6RCqZmjR8xihEL", + "featured_image_alt": "", + "author": { + "first_name": "SDK", + "last_name": "Tests", + "email": "sdktests@buttercms.com", + "slug": "sdk-tests", + "bio": "", + "title": "", + "linkedin_url": "", + "facebook_url": "", + "instagram_url": "", + "pinterest_url": "", + "twitter_handle": "", + "profile_image": "" + }, + "tags": [ + { + "name": "Example Tag", + "slug": "example-tag" + } + ], + "categories": [ + { + "name": "Example Category", + "slug": "example-category" + } + ], + "title": "Example Post", + "body": "Welcome to ButterCMS! This an example blog post written using Butter.
\nHere's a helpful walkthrough of our Blog Engine solution.
\n\n\n\n
If you're viewing this post from your website or command line, you've successfully made a request to the Butter API. If you haven't already, make sure you have our development guides pulled up for step-by-step instructions on setting up Butter.
\nButter's WYSIWYG editor supports standard text formatting including headings, links, quotes, code, text alignment, and more. You can upload, crop, and resize images which are automatically hosted and delivered through a CDN (see below). You can also edit HTML directly when needed.
\nYes. Butter can be used as a full CMS for managing dynamic content and creating pages across your entire website or app. Check out our development guides for step-by-step tutorials on setting this up.
\n", + "summary": "This is an example blog post. Pretty neat huh?", + "updated": "2024-05-17T14:13:46.813008Z", + "deleted": null, + "seo_title": "Example Post SEO Optimized Title", + "meta_description": "This is our example blog posts SEO optimized meta description.", + "status": "published" + } + ] + } + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/categories/test_category_all.json b/butter_cms/tests/fixtures/categories/test_category_all.json new file mode 100644 index 0000000..aa71ab2 --- /dev/null +++ b/butter_cms/tests/fixtures/categories/test_category_all.json @@ -0,0 +1,102 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/categories/", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Access-Control-Allow-Origin": [ + "*" + ], + "X-Served-By": [ + "cache-iad-kcgs7200169-IAD, cache-vie6347-VIE" + ], + "content-length": [ + "64" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "Date": [ + "Mon, 20 May 2024 12:52:34 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Cache": [ + "MISS, MISS" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "X-Frame-Options": [ + "DENY" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Connection": [ + "keep-alive" + ], + "Referrer-Policy": [ + "same-origin" + ], + "X-Timer": [ + "S1716209554.043590,VS0,VE129" + ], + "Accept-Ranges": [ + "bytes" + ], + "Age": [ + "0" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Content-Type": [ + "application/json" + ] + }, + "body": { + "string": "{\"data\":[{\"name\":\"Example Category\",\"slug\":\"example-category\"}]}", + "object": { + "data": [ + { + "name": "Example Category", + "slug": "example-category" + } + ] + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/categories/test_category_all_invalid_token.json b/butter_cms/tests/fixtures/categories/test_category_all_invalid_token.json new file mode 100644 index 0000000..18e7e07 --- /dev/null +++ b/butter_cms/tests/fixtures/categories/test_category_all_invalid_token.json @@ -0,0 +1,97 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/categories/", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 401, + "message": "Unauthorized" + }, + "headers": { + "Access-Control-Allow-Origin": [ + "*" + ], + "X-Served-By": [ + "cache-iad-kcgs7200135-IAD, cache-vie6337-VIE" + ], + "Content-Length": [ + "27" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "Date": [ + "Mon, 20 May 2024 12:52:34 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Cache": [ + "MISS, MISS" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Vary": [ + "Origin" + ], + "X-Frame-Options": [ + "DENY" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Connection": [ + "keep-alive" + ], + "Referrer-Policy": [ + "same-origin" + ], + "X-Timer": [ + "S1716209554.436547,VS0,VE133" + ], + "Accept-Ranges": [ + "bytes" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Content-Type": [ + "application/json" + ], + "Www-Authenticate": [ + "Token" + ] + }, + "body": { + "string": "{\"detail\":\"Invalid token.\"}", + "object": { + "detail": "Invalid token." + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/categories/test_category_all_with_recent_posts.json b/butter_cms/tests/fixtures/categories/test_category_all_with_recent_posts.json new file mode 100644 index 0000000..d37fc04 --- /dev/null +++ b/butter_cms/tests/fixtures/categories/test_category_all_with_recent_posts.json @@ -0,0 +1,146 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/categories/?include=recent_posts", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Access-Control-Allow-Origin": [ + "*" + ], + "X-Served-By": [ + "cache-iad-kjyo7100121-IAD, cache-vie6350-VIE" + ], + "content-length": [ + "3181" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "Date": [ + "Mon, 20 May 2024 12:52:34 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Cache": [ + "MISS, MISS" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "X-Frame-Options": [ + "DENY" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Connection": [ + "keep-alive" + ], + "Referrer-Policy": [ + "same-origin" + ], + "X-Timer": [ + "S1716209554.225850,VS0,VE138" + ], + "Accept-Ranges": [ + "bytes" + ], + "Age": [ + "0" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Content-Type": [ + "application/json" + ] + }, + "body": { + "string": "{\"data\":[{\"name\":\"Example Category\",\"slug\":\"example-category\",\"recent_posts\":[{\"created\":\"2024-05-17T14:13:46.787544Z\",\"published\":\"2024-05-17T14:13:46.787109Z\",\"url\":null,\"slug\":\"example-post\",\"featured_image\":\"https://cdn.buttercms.com/WUkiXJ6RCqZmjR8xihEL\",\"featured_image_alt\":\"\",\"author\":{\"first_name\":\"SDK\",\"last_name\":\"Tests\",\"email\":\"sdktests@buttercms.com\",\"slug\":\"sdk-tests\",\"bio\":\"\",\"title\":\"\",\"linkedin_url\":\"\",\"facebook_url\":\"\",\"instagram_url\":\"\",\"pinterest_url\":\"\",\"twitter_handle\":\"\",\"profile_image\":\"\"},\"tags\":[{\"name\":\"Example Tag\",\"slug\":\"example-tag\"}],\"categories\":[{\"name\":\"Example Category\",\"slug\":\"example-category\"}],\"title\":\"Example Post\",\"body\":\"Welcome to ButterCMS! This an example blog post written using Butter.
\\nHere's a helpful walkthrough of our Blog Engine solution.
\\n\\n\\n\\n
If you're viewing this post from your website or command line, you've successfully made a request to the Butter API. If you haven't already, make sure you have our development guides pulled up for step-by-step instructions on setting up Butter.
\\nButter's WYSIWYG editor supports standard text formatting including headings, links, quotes, code, text alignment, and more. You can upload, crop, and resize images which are automatically hosted and delivered through a CDN (see below). You can also edit HTML directly when needed.
\\nYes. Butter can be used as a full CMS for managing dynamic content and creating pages across your entire website or app. Check out our development guides for step-by-step tutorials on setting this up.
\\n\",\"summary\":\"This is an example blog post. Pretty neat huh?\",\"updated\":\"2024-05-17T14:13:46.813008Z\",\"deleted\":null,\"seo_title\":\"Example Post SEO Optimized Title\",\"meta_description\":\"This is our example blog posts SEO optimized meta description.\",\"status\":\"published\"}]}]}", + "object": { + "data": [ + { + "name": "Example Category", + "slug": "example-category", + "recent_posts": [ + { + "created": "2024-05-17T14:13:46.787544Z", + "published": "2024-05-17T14:13:46.787109Z", + "url": null, + "slug": "example-post", + "featured_image": "https://cdn.buttercms.com/WUkiXJ6RCqZmjR8xihEL", + "featured_image_alt": "", + "author": { + "first_name": "SDK", + "last_name": "Tests", + "email": "sdktests@buttercms.com", + "slug": "sdk-tests", + "bio": "", + "title": "", + "linkedin_url": "", + "facebook_url": "", + "instagram_url": "", + "pinterest_url": "", + "twitter_handle": "", + "profile_image": "" + }, + "tags": [ + { + "name": "Example Tag", + "slug": "example-tag" + } + ], + "categories": [ + { + "name": "Example Category", + "slug": "example-category" + } + ], + "title": "Example Post", + "body": "Welcome to ButterCMS! This an example blog post written using Butter.
\nHere's a helpful walkthrough of our Blog Engine solution.
\n\n\n\n
If you're viewing this post from your website or command line, you've successfully made a request to the Butter API. If you haven't already, make sure you have our development guides pulled up for step-by-step instructions on setting up Butter.
\nButter's WYSIWYG editor supports standard text formatting including headings, links, quotes, code, text alignment, and more. You can upload, crop, and resize images which are automatically hosted and delivered through a CDN (see below). You can also edit HTML directly when needed.
\nYes. Butter can be used as a full CMS for managing dynamic content and creating pages across your entire website or app. Check out our development guides for step-by-step tutorials on setting this up.
\n", + "summary": "This is an example blog post. Pretty neat huh?", + "updated": "2024-05-17T14:13:46.813008Z", + "deleted": null, + "seo_title": "Example Post SEO Optimized Title", + "meta_description": "This is our example blog posts SEO optimized meta description.", + "status": "published" + } + ] + } + ] + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/categories/test_category_get.json b/butter_cms/tests/fixtures/categories/test_category_get.json new file mode 100644 index 0000000..571b87a --- /dev/null +++ b/butter_cms/tests/fixtures/categories/test_category_get.json @@ -0,0 +1,100 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/categories/example-category", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "content-length": [ + "62" + ], + "Age": [ + "0" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "X-Cache": [ + "MISS, MISS" + ], + "Date": [ + "Mon, 20 May 2024 12:53:23 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Connection": [ + "keep-alive" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Content-Type": [ + "application/json" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "X-Served-By": [ + "cache-iad-kcgs7200104-IAD, cache-vie6336-VIE" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "X-Timer": [ + "S1716209604.625953,VS0,VE131" + ], + "Accept-Ranges": [ + "bytes" + ], + "Referrer-Policy": [ + "same-origin" + ], + "X-Frame-Options": [ + "DENY" + ] + }, + "body": { + "string": "{\"data\":{\"name\":\"Example Category\",\"slug\":\"example-category\"}}", + "object": { + "data": { + "name": "Example Category", + "slug": "example-category" + } + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/categories/test_category_get_invalid_token.json b/butter_cms/tests/fixtures/categories/test_category_get_invalid_token.json new file mode 100644 index 0000000..7312de2 --- /dev/null +++ b/butter_cms/tests/fixtures/categories/test_category_get_invalid_token.json @@ -0,0 +1,97 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/categories/example-category", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 401, + "message": "Unauthorized" + }, + "headers": { + "Www-Authenticate": [ + "Token" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Content-Length": [ + "27" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "X-Cache": [ + "MISS, MISS" + ], + "Date": [ + "Mon, 20 May 2024 12:53:24 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Connection": [ + "keep-alive" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Content-Type": [ + "application/json" + ], + "Vary": [ + "Origin" + ], + "X-Served-By": [ + "cache-iad-kjyo7100153-IAD, cache-vie6345-VIE" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "X-Timer": [ + "S1716209604.022195,VS0,VE168" + ], + "Accept-Ranges": [ + "bytes" + ], + "Referrer-Policy": [ + "same-origin" + ], + "X-Frame-Options": [ + "DENY" + ] + }, + "body": { + "string": "{\"detail\":\"Invalid token.\"}", + "object": { + "detail": "Invalid token." + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/categories/test_category_get_with_recent_posts.json b/butter_cms/tests/fixtures/categories/test_category_get_with_recent_posts.json new file mode 100644 index 0000000..1554b8b --- /dev/null +++ b/butter_cms/tests/fixtures/categories/test_category_get_with_recent_posts.json @@ -0,0 +1,144 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/categories/example-category?include=recent_posts", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "content-length": [ + "3179" + ], + "Age": [ + "0" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "X-Cache": [ + "MISS, MISS" + ], + "Date": [ + "Mon, 20 May 2024 12:53:23 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Connection": [ + "keep-alive" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Content-Type": [ + "application/json" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "X-Served-By": [ + "cache-iad-kcgs7200138-IAD, cache-vie6355-VIE" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "X-Timer": [ + "S1716209604.817853,VS0,VE140" + ], + "Accept-Ranges": [ + "bytes" + ], + "Referrer-Policy": [ + "same-origin" + ], + "X-Frame-Options": [ + "DENY" + ] + }, + "body": { + "string": "{\"data\":{\"name\":\"Example Category\",\"slug\":\"example-category\",\"recent_posts\":[{\"created\":\"2024-05-17T14:13:46.787544Z\",\"published\":\"2024-05-17T14:13:46.787109Z\",\"url\":null,\"slug\":\"example-post\",\"featured_image\":\"https://cdn.buttercms.com/WUkiXJ6RCqZmjR8xihEL\",\"featured_image_alt\":\"\",\"author\":{\"first_name\":\"SDK\",\"last_name\":\"Tests\",\"email\":\"sdktests@buttercms.com\",\"slug\":\"sdk-tests\",\"bio\":\"\",\"title\":\"\",\"linkedin_url\":\"\",\"facebook_url\":\"\",\"instagram_url\":\"\",\"pinterest_url\":\"\",\"twitter_handle\":\"\",\"profile_image\":\"\"},\"tags\":[{\"name\":\"Example Tag\",\"slug\":\"example-tag\"}],\"categories\":[{\"name\":\"Example Category\",\"slug\":\"example-category\"}],\"title\":\"Example Post\",\"body\":\"Welcome to ButterCMS! This an example blog post written using Butter.
\\nHere's a helpful walkthrough of our Blog Engine solution.
\\n\\n\\n\\n
If you're viewing this post from your website or command line, you've successfully made a request to the Butter API. If you haven't already, make sure you have our development guides pulled up for step-by-step instructions on setting up Butter.
\\nButter's WYSIWYG editor supports standard text formatting including headings, links, quotes, code, text alignment, and more. You can upload, crop, and resize images which are automatically hosted and delivered through a CDN (see below). You can also edit HTML directly when needed.
\\nYes. Butter can be used as a full CMS for managing dynamic content and creating pages across your entire website or app. Check out our development guides for step-by-step tutorials on setting this up.
\\n\",\"summary\":\"This is an example blog post. Pretty neat huh?\",\"updated\":\"2024-05-17T14:13:46.813008Z\",\"deleted\":null,\"seo_title\":\"Example Post SEO Optimized Title\",\"meta_description\":\"This is our example blog posts SEO optimized meta description.\",\"status\":\"published\"}]}}", + "object": { + "data": { + "name": "Example Category", + "slug": "example-category", + "recent_posts": [ + { + "created": "2024-05-17T14:13:46.787544Z", + "published": "2024-05-17T14:13:46.787109Z", + "url": null, + "slug": "example-post", + "featured_image": "https://cdn.buttercms.com/WUkiXJ6RCqZmjR8xihEL", + "featured_image_alt": "", + "author": { + "first_name": "SDK", + "last_name": "Tests", + "email": "sdktests@buttercms.com", + "slug": "sdk-tests", + "bio": "", + "title": "", + "linkedin_url": "", + "facebook_url": "", + "instagram_url": "", + "pinterest_url": "", + "twitter_handle": "", + "profile_image": "" + }, + "tags": [ + { + "name": "Example Tag", + "slug": "example-tag" + } + ], + "categories": [ + { + "name": "Example Category", + "slug": "example-category" + } + ], + "title": "Example Post", + "body": "Welcome to ButterCMS! This an example blog post written using Butter.
\nHere's a helpful walkthrough of our Blog Engine solution.
\n\n\n\n
If you're viewing this post from your website or command line, you've successfully made a request to the Butter API. If you haven't already, make sure you have our development guides pulled up for step-by-step instructions on setting up Butter.
\nButter's WYSIWYG editor supports standard text formatting including headings, links, quotes, code, text alignment, and more. You can upload, crop, and resize images which are automatically hosted and delivered through a CDN (see below). You can also edit HTML directly when needed.
\nYes. Butter can be used as a full CMS for managing dynamic content and creating pages across your entire website or app. Check out our development guides for step-by-step tutorials on setting this up.
\n", + "summary": "This is an example blog post. Pretty neat huh?", + "updated": "2024-05-17T14:13:46.813008Z", + "deleted": null, + "seo_title": "Example Post SEO Optimized Title", + "meta_description": "This is our example blog posts SEO optimized meta description.", + "status": "published" + } + ] + } + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/content_fields/test_content_field_all.json b/butter_cms/tests/fixtures/content_fields/test_content_field_all.json new file mode 100644 index 0000000..cbb9758 --- /dev/null +++ b/butter_cms/tests/fixtures/content_fields/test_content_field_all.json @@ -0,0 +1,95 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/content/", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Age": [ + "2207" + ], + "X-Timer": [ + "S1716212270.947981,VS0,VE0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Allow": [ + "GET, POST, HEAD, OPTIONS" + ], + "Content-Type": [ + "application/json" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Accept-Ranges": [ + "bytes" + ], + "X-Cache-Hits": [ + "0, 2" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Date": [ + "Mon, 20 May 2024 13:37:49 GMT" + ], + "Referrer-Policy": [ + "same-origin" + ], + "Connection": [ + "keep-alive" + ], + "X-Cache": [ + "MISS, HIT" + ], + "X-Frame-Options": [ + "DENY" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "X-Served-By": [ + "cache-iad-kcgs7200065-IAD, cache-vie6326-VIE" + ], + "content-length": [ + "2" + ], + "Server": [ + "gunicorn/19.9.0" + ] + }, + "body": { + "string": "{}", + "object": {} + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/content_fields/test_content_field_all_filtered.json b/butter_cms/tests/fixtures/content_fields/test_content_field_all_filtered.json new file mode 100644 index 0000000..8c78295 --- /dev/null +++ b/butter_cms/tests/fixtures/content_fields/test_content_field_all_filtered.json @@ -0,0 +1,194 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/content/?keys=navigation_menu%2Cnavigation_menu_item", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Age": [ + "2233" + ], + "X-Timer": [ + "S1716212270.001190,VS0,VE1" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Allow": [ + "GET, POST, HEAD, OPTIONS" + ], + "Content-Type": [ + "application/json" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Accept-Ranges": [ + "bytes" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Date": [ + "Mon, 20 May 2024 13:37:50 GMT" + ], + "Referrer-Policy": [ + "same-origin" + ], + "Connection": [ + "keep-alive" + ], + "X-Cache": [ + "MISS, HIT" + ], + "X-Frame-Options": [ + "DENY" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "X-Served-By": [ + "cache-iad-kjyo7100104-IAD, cache-vie6378-VIE" + ], + "content-length": [ + "794" + ], + "Server": [ + "gunicorn/19.9.0" + ] + }, + "body": { + "string": "{\"data\":{\"navigation_menu\":[{\"meta\":{\"id\":735751},\"name\":\"Main menu\",\"menu_items\":[{\"meta\":{\"id\":735745},\"label\":\"Home\",\"url\":\"#home\"},{\"meta\":{\"id\":735746},\"label\":\"About\",\"url\":\"#about\"},{\"meta\":{\"id\":735747},\"label\":\"Features\",\"url\":\"#features\"},{\"meta\":{\"id\":735748},\"label\":\"Try It\",\"url\":\"#tryit\"},{\"meta\":{\"id\":735749},\"label\":\"Testimonials\",\"url\":\"#testimonials\"},{\"meta\":{\"id\":735750},\"label\":\"Blog\",\"url\":\"#blog\"}]}],\"navigation_menu_item\":[{\"meta\":{\"id\":735745},\"label\":\"Home\",\"url\":\"#home\"},{\"meta\":{\"id\":735746},\"label\":\"About\",\"url\":\"#about\"},{\"meta\":{\"id\":735747},\"label\":\"Features\",\"url\":\"#features\"},{\"meta\":{\"id\":735748},\"label\":\"Try It\",\"url\":\"#tryit\"},{\"meta\":{\"id\":735749},\"label\":\"Testimonials\",\"url\":\"#testimonials\"},{\"meta\":{\"id\":735750},\"label\":\"Blog\",\"url\":\"#blog\"}]}}", + "object": { + "data": { + "navigation_menu": [ + { + "meta": { + "id": 735751 + }, + "name": "Main menu", + "menu_items": [ + { + "meta": { + "id": 735745 + }, + "label": "Home", + "url": "#home" + }, + { + "meta": { + "id": 735746 + }, + "label": "About", + "url": "#about" + }, + { + "meta": { + "id": 735747 + }, + "label": "Features", + "url": "#features" + }, + { + "meta": { + "id": 735748 + }, + "label": "Try It", + "url": "#tryit" + }, + { + "meta": { + "id": 735749 + }, + "label": "Testimonials", + "url": "#testimonials" + }, + { + "meta": { + "id": 735750 + }, + "label": "Blog", + "url": "#blog" + } + ] + } + ], + "navigation_menu_item": [ + { + "meta": { + "id": 735745 + }, + "label": "Home", + "url": "#home" + }, + { + "meta": { + "id": 735746 + }, + "label": "About", + "url": "#about" + }, + { + "meta": { + "id": 735747 + }, + "label": "Features", + "url": "#features" + }, + { + "meta": { + "id": 735748 + }, + "label": "Try It", + "url": "#tryit" + }, + { + "meta": { + "id": 735749 + }, + "label": "Testimonials", + "url": "#testimonials" + }, + { + "meta": { + "id": 735750 + }, + "label": "Blog", + "url": "#blog" + } + ] + } + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/content_fields/test_content_field_all_invalid_token.json b/butter_cms/tests/fixtures/content_fields/test_content_field_all_invalid_token.json new file mode 100644 index 0000000..36d744b --- /dev/null +++ b/butter_cms/tests/fixtures/content_fields/test_content_field_all_invalid_token.json @@ -0,0 +1,97 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/content/", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 401, + "message": "Unauthorized" + }, + "headers": { + "X-Timer": [ + "S1716212270.767120,VS0,VE122" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Allow": [ + "GET, POST, HEAD, OPTIONS" + ], + "Content-Type": [ + "application/json" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Accept-Ranges": [ + "bytes" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Date": [ + "Mon, 20 May 2024 13:37:49 GMT" + ], + "Referrer-Policy": [ + "same-origin" + ], + "Www-Authenticate": [ + "Token" + ], + "Connection": [ + "keep-alive" + ], + "X-Cache": [ + "MISS, MISS" + ], + "X-Frame-Options": [ + "DENY" + ], + "Vary": [ + "Origin" + ], + "X-Served-By": [ + "cache-iad-kiad7000119-IAD, cache-vie6378-VIE" + ], + "Content-Length": [ + "27" + ], + "Server": [ + "gunicorn/19.9.0" + ] + }, + "body": { + "string": "{\"detail\":\"Invalid token.\"}", + "object": { + "detail": "Invalid token." + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/content_fields/test_content_field_all_non_existent_key.json b/butter_cms/tests/fixtures/content_fields/test_content_field_all_non_existent_key.json new file mode 100644 index 0000000..0d54549 --- /dev/null +++ b/butter_cms/tests/fixtures/content_fields/test_content_field_all_non_existent_key.json @@ -0,0 +1,97 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/content/?keys=non-existent-key", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 404, + "message": "Not Found" + }, + "headers": { + "Age": [ + "2550" + ], + "X-Timer": [ + "S1716212270.055520,VS0,VE1" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Allow": [ + "GET, POST, HEAD, OPTIONS" + ], + "Content-Type": [ + "application/json" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Accept-Ranges": [ + "bytes" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Date": [ + "Mon, 20 May 2024 13:37:50 GMT" + ], + "Referrer-Policy": [ + "same-origin" + ], + "Connection": [ + "keep-alive" + ], + "X-Cache": [ + "MISS, HIT" + ], + "X-Frame-Options": [ + "DENY" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "X-Served-By": [ + "cache-iad-kiad7000145-IAD, cache-vie6365-VIE" + ], + "content-length": [ + "51" + ], + "Server": [ + "gunicorn/19.9.0" + ] + }, + "body": { + "string": "{\"detail\":\"Content key non-existent-key not found\"}", + "object": { + "detail": "Content key non-existent-key not found" + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/content_fields/test_content_field_get.json b/butter_cms/tests/fixtures/content_fields/test_content_field_get.json new file mode 100644 index 0000000..2bb2515 --- /dev/null +++ b/butter_cms/tests/fixtures/content_fields/test_content_field_get.json @@ -0,0 +1,147 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/content/navigation_menu_item/", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "Connection": [ + "keep-alive" + ], + "Age": [ + "1171" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Referrer-Policy": [ + "same-origin" + ], + "X-Served-By": [ + "cache-iad-kcgs7200124-IAD, cache-vie6383-VIE" + ], + "Accept-Ranges": [ + "bytes" + ], + "X-Cache": [ + "MISS, HIT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Date": [ + "Mon, 20 May 2024 13:38:08 GMT" + ], + "X-Timer": [ + "S1716212289.984366,VS0,VE1" + ], + "X-Frame-Options": [ + "DENY" + ], + "content-length": [ + "433" + ] + }, + "body": { + "string": "{\"meta\":{\"count\":6,\"next_page\":null,\"previous_page\":null},\"data\":{\"navigation_menu_item\":[{\"meta\":{\"id\":735745},\"label\":\"Home\",\"url\":\"#home\"},{\"meta\":{\"id\":735746},\"label\":\"About\",\"url\":\"#about\"},{\"meta\":{\"id\":735747},\"label\":\"Features\",\"url\":\"#features\"},{\"meta\":{\"id\":735748},\"label\":\"Try It\",\"url\":\"#tryit\"},{\"meta\":{\"id\":735749},\"label\":\"Testimonials\",\"url\":\"#testimonials\"},{\"meta\":{\"id\":735750},\"label\":\"Blog\",\"url\":\"#blog\"}]}}", + "object": { + "meta": { + "count": 6, + "next_page": null, + "previous_page": null + }, + "data": { + "navigation_menu_item": [ + { + "meta": { + "id": 735745 + }, + "label": "Home", + "url": "#home" + }, + { + "meta": { + "id": 735746 + }, + "label": "About", + "url": "#about" + }, + { + "meta": { + "id": 735747 + }, + "label": "Features", + "url": "#features" + }, + { + "meta": { + "id": 735748 + }, + "label": "Try It", + "url": "#tryit" + }, + { + "meta": { + "id": 735749 + }, + "label": "Testimonials", + "url": "#testimonials" + }, + { + "meta": { + "id": 735750 + }, + "label": "Blog", + "url": "#blog" + } + ] + } + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/content_fields/test_content_field_get_filtered.json b/butter_cms/tests/fixtures/content_fields/test_content_field_get_filtered.json new file mode 100644 index 0000000..28fc691 --- /dev/null +++ b/butter_cms/tests/fixtures/content_fields/test_content_field_get_filtered.json @@ -0,0 +1,112 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/content/navigation_menu_item/?fields.label=Testimonials", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "Connection": [ + "keep-alive" + ], + "Age": [ + "1844" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Referrer-Policy": [ + "same-origin" + ], + "X-Served-By": [ + "cache-iad-kcgs7200144-IAD, cache-vie6374-VIE" + ], + "Accept-Ranges": [ + "bytes" + ], + "X-Cache": [ + "MISS, HIT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Date": [ + "Mon, 20 May 2024 13:38:09 GMT" + ], + "X-Timer": [ + "S1716212289.036940,VS0,VE1" + ], + "X-Frame-Options": [ + "DENY" + ], + "content-length": [ + "160" + ] + }, + "body": { + "string": "{\"meta\":{\"count\":1,\"next_page\":null,\"previous_page\":null},\"data\":{\"navigation_menu_item\":[{\"meta\":{\"id\":735749},\"label\":\"Testimonials\",\"url\":\"#testimonials\"}]}}", + "object": { + "meta": { + "count": 1, + "next_page": null, + "previous_page": null + }, + "data": { + "navigation_menu_item": [ + { + "meta": { + "id": 735749 + }, + "label": "Testimonials", + "url": "#testimonials" + } + ] + } + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/content_fields/test_content_field_get_invalid_token.json b/butter_cms/tests/fixtures/content_fields/test_content_field_get_invalid_token.json new file mode 100644 index 0000000..7360742 --- /dev/null +++ b/butter_cms/tests/fixtures/content_fields/test_content_field_get_invalid_token.json @@ -0,0 +1,97 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/content/navigation_menu_item/", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 401, + "message": "Unauthorized" + }, + "headers": { + "Content-Type": [ + "application/json" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "Connection": [ + "keep-alive" + ], + "Vary": [ + "Origin" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Referrer-Policy": [ + "same-origin" + ], + "X-Served-By": [ + "cache-iad-kiad7000090-IAD, cache-vie6326-VIE" + ], + "Accept-Ranges": [ + "bytes" + ], + "Www-Authenticate": [ + "Token" + ], + "X-Cache": [ + "MISS, MISS" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Date": [ + "Mon, 20 May 2024 13:38:09 GMT" + ], + "X-Timer": [ + "S1716212289.136508,VS0,VE123" + ], + "X-Frame-Options": [ + "DENY" + ], + "Content-Length": [ + "27" + ] + }, + "body": { + "string": "{\"detail\":\"Invalid token.\"}", + "object": { + "detail": "Invalid token." + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/content_fields/test_content_field_get_non_existent_field.json b/butter_cms/tests/fixtures/content_fields/test_content_field_get_non_existent_field.json new file mode 100644 index 0000000..0867fc0 --- /dev/null +++ b/butter_cms/tests/fixtures/content_fields/test_content_field_get_non_existent_field.json @@ -0,0 +1,97 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/content/not-existent-field/", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 404, + "message": "Not Found" + }, + "headers": { + "Content-Type": [ + "application/json" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "Connection": [ + "keep-alive" + ], + "Age": [ + "293" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Referrer-Policy": [ + "same-origin" + ], + "X-Served-By": [ + "cache-iad-kiad7000121-IAD, cache-vie6328-VIE" + ], + "Accept-Ranges": [ + "bytes" + ], + "X-Cache": [ + "MISS, HIT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Date": [ + "Mon, 20 May 2024 13:38:09 GMT" + ], + "X-Timer": [ + "S1716212289.086874,VS0,VE1" + ], + "X-Frame-Options": [ + "DENY" + ], + "content-length": [ + "23" + ] + }, + "body": { + "string": "{\"detail\":\"Not found.\"}", + "object": { + "detail": "Not found." + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/feeds/test_feed_atom.json b/butter_cms/tests/fixtures/feeds/test_feed_atom.json new file mode 100644 index 0000000..c0aa804 --- /dev/null +++ b/butter_cms/tests/fixtures/feeds/test_feed_atom.json @@ -0,0 +1,97 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/feeds/atom", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Accept-Ranges": [ + "bytes" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "Age": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Connection": [ + "keep-alive" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "X-Served-By": [ + "cache-iad-kcgs7200085-IAD, cache-vie6327-VIE" + ], + "X-Cache": [ + "MISS, MISS" + ], + "X-Frame-Options": [ + "DENY" + ], + "content-length": [ + "756" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "X-Timer": [ + "S1716212449.979703,VS0,VE193" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Date": [ + "Mon, 20 May 2024 13:40:49 GMT" + ], + "Referrer-Policy": [ + "same-origin" + ] + }, + "body": { + "string": "{\"data\":\"\\nHere's a helpful walkthrough of our Blog Engine solution.
\\n\\n\\n\\n
If you're viewing this post from your website or command line, you've successfully made a request to the Butter API. If you haven't already, make sure you have our development guides pulled up for step-by-step instructions on setting up Butter.
\\nButter's WYSIWYG editor supports standard text formatting including headings, links, quotes, code, text alignment, and more. You can upload, crop, and resize images which are automatically hosted and delivered through a CDN (see below). You can also edit HTML directly when needed.
\\nYes. Butter can be used as a full CMS for managing dynamic content and creating pages across your entire website or app. Check out our development guides for step-by-step tutorials on setting this up.
\\n]]>\\nHere's a helpful walkthrough of our Blog Engine solution.
\n\n\n\n
If you're viewing this post from your website or command line, you've successfully made a request to the Butter API. If you haven't already, make sure you have our development guides pulled up for step-by-step instructions on setting up Butter.
\nButter's WYSIWYG editor supports standard text formatting including headings, links, quotes, code, text alignment, and more. You can upload, crop, and resize images which are automatically hosted and delivered through a CDN (see below). You can also edit HTML directly when needed.
\nYes. Butter can be used as a full CMS for managing dynamic content and creating pages across your entire website or app. Check out our development guides for step-by-step tutorials on setting this up.
\n]]>\nTry updating the content of this page to reflect your own. You can also explore modifying these components or creating your own in your Butter dashboard. Learn more about Page Types and Components.
\",\"image\":\"https://cdn.buttercms.com/AJPaLE3ToKRoLwWQeaww\",\"image_position\":\"right\",\"button_label\":\"Update this Page in Butter\",\"button_url\":\"https://buttercms.com/pages/\",\"scroll_anchor_id\":\"tryit\"}},{\"type\":\"testimonials\",\"fields\":{\"headline\":\"What our customers say\",\"scroll_anchor_id\":\"testimonials\",\"testimonial\":[{\"quote\":\"Super Flexible CMS Solution\",\"name\":\"Hampton Catlin\",\"title\":\"Creator of Sass and Haml\"},{\"quote\":\"A breath of fresh air in the CMS world, once you go headless with butter you'll never go back.\",\"name\":\"Bryan MacMillan\",\"title\":\"IT Admin\"},{\"quote\":\"I was able to quickly draft new pages, circulate them to the team, edit them, and then ultimately publish intuitively.\",\"name\":\"Kim Kohatsu\",\"title\":\"CMO\"}]}}]}}]}", + "object": { + "meta": { + "next_page": null, + "previous_page": null, + "count": 1 + }, + "data": [ + { + "slug": "landing-page-with-components", + "name": "Landing Page with Components", + "published": "2024-05-17T14:14:41.484894Z", + "updated": "2024-05-17T14:14:41.522160Z", + "page_type": "landing-page", + "fields": { + "seo": { + "title": "Sample Landing Page with Components - powered by ButterCMS", + "description": "Sample Landing Page with Components - powered by ButterCMS" + }, + "body": [ + { + "type": "hero", + "fields": { + "headline": "Welcome to your ButterCMS Proof of Concept", + "subheadline": "Use this app as your own proof of concept to explore Butter's capabilities for yourself. When you're ready, host this app and invite your team to try it out all well!", + "image": "https://cdn.buttercms.com/DVG5DLMQ9ywaCwfEAgL2", + "button_label": "Update this Page in Butter", + "button_url": "https://buttercms.com/pages/", + "scroll_anchor_id": "home" + } + }, + { + "type": "two_column_with_image", + "fields": { + "headline": "ButterCMS is your content backend", + "subheadline": "Butter has three core content solutions: Pages, Posts, and Collections. Combine this with advanced capabilities like localization, Write API, multi-site + multi-env and Butter is your centralized content backend no matter how much content you're managing.", + "image": "https://cdn.buttercms.com/yg7mFNnNSpyXLpwvp0KX", + "image_position": "left", + "button_label": "Update this Page in Butter", + "button_url": "https://buttercms.com/pages/", + "scroll_anchor_id": "about" + } + }, + { + "type": "features", + "fields": { + "headline": "This page is built using ButterCMS Components", + "subheadline": "This page is an example of utilizing Butter Components which allow you to build dynamic landing pages by choosing Components from a Component Library. Reuse and reorder Components in any way you want!", + "scroll_anchor_id": "features", + "features": [ + { + "headline": "Components on this page", + "description": "This sample page has four component types: hero, two column with image, features, and testimonials.", + "icon": "https://cdn.buttercms.com/1evWeDvPQ3eby8N5pZsg" + }, + { + "headline": "Build your own", + "description": "This page is just an example set of Components. You can build your own custom Component library!", + "icon": "https://cdn.buttercms.com/WX5OIKIPQAmu0YCAjZpH" + }, + { + "headline": "Reorder them", + "description": "Components are great because you can reorder them from your Butter dashboard", + "icon": "https://cdn.buttercms.com/h2nnt9PZSbaj20FLScbP" + }, + { + "headline": "Infinite possibilities", + "description": "Build carousels, call to actions, testimonials, and much more. There's infinite flexbility.", + "icon": "https://cdn.buttercms.com/FwNLtx6dR7ybtG1WenrK" + } + ] + } + }, + { + "type": "two_column_with_image", + "fields": { + "headline": "Customize this page", + "subheadline": "Try updating the content of this page to reflect your own. You can also explore modifying these components or creating your own in your Butter dashboard. Learn more about Page Types and Components.
", + "image": "https://cdn.buttercms.com/AJPaLE3ToKRoLwWQeaww", + "image_position": "right", + "button_label": "Update this Page in Butter", + "button_url": "https://buttercms.com/pages/", + "scroll_anchor_id": "tryit" + } + }, + { + "type": "testimonials", + "fields": { + "headline": "What our customers say", + "scroll_anchor_id": "testimonials", + "testimonial": [ + { + "quote": "Super Flexible CMS Solution", + "name": "Hampton Catlin", + "title": "Creator of Sass and Haml" + }, + { + "quote": "A breath of fresh air in the CMS world, once you go headless with butter you'll never go back.", + "name": "Bryan MacMillan", + "title": "IT Admin" + }, + { + "quote": "I was able to quickly draft new pages, circulate them to the team, edit them, and then ultimately publish intuitively.", + "name": "Kim Kohatsu", + "title": "CMO" + } + ] + } + } + ] + } + } + ] + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/pages/test_page_all_invalid_token.json b/butter_cms/tests/fixtures/pages/test_page_all_invalid_token.json new file mode 100644 index 0000000..e2d1e2c --- /dev/null +++ b/butter_cms/tests/fixtures/pages/test_page_all_invalid_token.json @@ -0,0 +1,97 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/pages/landing-page/", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 401, + "message": "Unauthorized" + }, + "headers": { + "X-Served-By": [ + "cache-iad-kiad7000131-IAD, cache-vie6344-VIE" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "X-Cache": [ + "MISS, MISS" + ], + "Content-Length": [ + "27" + ], + "Vary": [ + "Origin" + ], + "Content-Type": [ + "application/json" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Connection": [ + "keep-alive" + ], + "Www-Authenticate": [ + "Token" + ], + "Date": [ + "Mon, 20 May 2024 13:55:39 GMT" + ], + "Accept-Ranges": [ + "bytes" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "DENY" + ], + "X-Timer": [ + "S1716213340.661616,VS0,VE122" + ], + "Referrer-Policy": [ + "same-origin" + ] + }, + "body": { + "string": "{\"detail\":\"Invalid token.\"}", + "object": { + "detail": "Invalid token." + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/pages/test_page_all_without_page_type.json b/butter_cms/tests/fixtures/pages/test_page_all_without_page_type.json new file mode 100644 index 0000000..85bbf8a --- /dev/null +++ b/butter_cms/tests/fixtures/pages/test_page_all_without_page_type.json @@ -0,0 +1,124 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/pages/*/", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-Served-By": [ + "cache-iad-kjyo7100118-IAD, cache-vie6354-VIE" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "X-Cache": [ + "MISS, HIT" + ], + "content-length": [ + "573" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "Content-Type": [ + "application/json" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Age": [ + "206" + ], + "Connection": [ + "keep-alive" + ], + "Date": [ + "Mon, 20 May 2024 13:55:40 GMT" + ], + "Accept-Ranges": [ + "bytes" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "DENY" + ], + "X-Timer": [ + "S1716213340.043015,VS0,VE1" + ], + "Referrer-Policy": [ + "same-origin" + ] + }, + "body": { + "string": "{\"meta\":{\"next_page\":null,\"previous_page\":null,\"count\":1},\"data\":[{\"slug\":\"simple-page\",\"name\":\"Simple Page\",\"published\":\"2024-05-17T14:14:47.533297Z\",\"updated\":\"2024-05-17T14:14:47.550734Z\",\"page_type\":null,\"fields\":{\"seo_title\":\"Anvils and Dynamite | Acme Co\",\"headline\":\"Acme Co provides supplies to your favorite cartoon heroes.\",\"hero_image\":\"https://cdn.buttercms.com/c8oSTGcwQDC5I58km5WV\",\"call_to_action\":\"Buy Now\",\"customer_logos\":[{\"logo_image\":\"https://cdn.buttercms.com/1FNvDuOJSROw1fybRCYU\"},{\"logo_image\":\"https://cdn.buttercms.com/1FNvDuOJSROw1fybRCYU\"}]}}]}", + "object": { + "meta": { + "next_page": null, + "previous_page": null, + "count": 1 + }, + "data": [ + { + "slug": "simple-page", + "name": "Simple Page", + "published": "2024-05-17T14:14:47.533297Z", + "updated": "2024-05-17T14:14:47.550734Z", + "page_type": null, + "fields": { + "seo_title": "Anvils and Dynamite | Acme Co", + "headline": "Acme Co provides supplies to your favorite cartoon heroes.", + "hero_image": "https://cdn.buttercms.com/c8oSTGcwQDC5I58km5WV", + "call_to_action": "Buy Now", + "customer_logos": [ + { + "logo_image": "https://cdn.buttercms.com/1FNvDuOJSROw1fybRCYU" + }, + { + "logo_image": "https://cdn.buttercms.com/1FNvDuOJSROw1fybRCYU" + } + ] + } + } + ] + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/pages/test_page_get.json b/butter_cms/tests/fixtures/pages/test_page_get.json new file mode 100644 index 0000000..21dfddf --- /dev/null +++ b/butter_cms/tests/fixtures/pages/test_page_get.json @@ -0,0 +1,200 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/pages/landing-page/landing-page-with-components/", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Allow": [ + "GET, PUT, PATCH, HEAD, OPTIONS" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Connection": [ + "keep-alive" + ], + "Age": [ + "0" + ], + "Date": [ + "Mon, 20 May 2024 13:58:45 GMT" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "X-Cache": [ + "MISS, MISS" + ], + "X-Frame-Options": [ + "DENY" + ], + "Accept-Ranges": [ + "bytes" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "X-Served-By": [ + "cache-iad-kjyo7100068-IAD, cache-vie6341-VIE" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "X-Timer": [ + "S1716213525.417996,VS0,VE151" + ], + "Referrer-Policy": [ + "same-origin" + ], + "Content-Type": [ + "application/json" + ], + "content-length": [ + "3693" + ] + }, + "body": { + "string": "{\"data\":{\"slug\":\"landing-page-with-components\",\"name\":\"Landing Page with Components\",\"published\":\"2024-05-17T14:14:41.484894Z\",\"updated\":\"2024-05-17T14:14:41.522160Z\",\"page_type\":\"landing-page\",\"fields\":{\"seo\":{\"title\":\"Sample Landing Page with Components - powered by ButterCMS\",\"description\":\"Sample Landing Page with Components - powered by ButterCMS\"},\"body\":[{\"type\":\"hero\",\"fields\":{\"headline\":\"Welcome to your ButterCMS Proof of Concept\",\"subheadline\":\"Use this app as your own proof of concept to explore Butter's capabilities for yourself. When you're ready, host this app and invite your team to try it out all well!\",\"image\":\"https://cdn.buttercms.com/DVG5DLMQ9ywaCwfEAgL2\",\"button_label\":\"Update this Page in Butter\",\"button_url\":\"https://buttercms.com/pages/\",\"scroll_anchor_id\":\"home\"}},{\"type\":\"two_column_with_image\",\"fields\":{\"headline\":\"ButterCMS is your content backend\",\"subheadline\":\"Butter has three core content solutions: Pages, Posts, and Collections. Combine this with advanced capabilities like localization, Write API, multi-site + multi-env and Butter is your centralized content backend no matter how much content you're managing.\",\"image\":\"https://cdn.buttercms.com/yg7mFNnNSpyXLpwvp0KX\",\"image_position\":\"left\",\"button_label\":\"Update this Page in Butter\",\"button_url\":\"https://buttercms.com/pages/\",\"scroll_anchor_id\":\"about\"}},{\"type\":\"features\",\"fields\":{\"headline\":\"This page is built using ButterCMS Components\",\"subheadline\":\"This page is an example of utilizing Butter Components which allow you to build dynamic landing pages by choosing Components from a Component Library. Reuse and reorder Components in any way you want!\",\"scroll_anchor_id\":\"features\",\"features\":[{\"headline\":\"Components on this page\",\"description\":\"This sample page has four component types: hero, two column with image, features, and testimonials.\",\"icon\":\"https://cdn.buttercms.com/1evWeDvPQ3eby8N5pZsg\"},{\"headline\":\"Build your own\",\"description\":\"This page is just an example set of Components. You can build your own custom Component library!\",\"icon\":\"https://cdn.buttercms.com/WX5OIKIPQAmu0YCAjZpH\"},{\"headline\":\"Reorder them\",\"description\":\"Components are great because you can reorder them from your Butter dashboard\",\"icon\":\"https://cdn.buttercms.com/h2nnt9PZSbaj20FLScbP\"},{\"headline\":\"Infinite possibilities\",\"description\":\"Build carousels, call to actions, testimonials, and much more. There's infinite flexbility.\",\"icon\":\"https://cdn.buttercms.com/FwNLtx6dR7ybtG1WenrK\"}]}},{\"type\":\"two_column_with_image\",\"fields\":{\"headline\":\"Customize this page\",\"subheadline\":\"Try updating the content of this page to reflect your own. You can also explore modifying these components or creating your own in your Butter dashboard. Learn more about Page Types and Components.
\",\"image\":\"https://cdn.buttercms.com/AJPaLE3ToKRoLwWQeaww\",\"image_position\":\"right\",\"button_label\":\"Update this Page in Butter\",\"button_url\":\"https://buttercms.com/pages/\",\"scroll_anchor_id\":\"tryit\"}},{\"type\":\"testimonials\",\"fields\":{\"headline\":\"What our customers say\",\"scroll_anchor_id\":\"testimonials\",\"testimonial\":[{\"quote\":\"Super Flexible CMS Solution\",\"name\":\"Hampton Catlin\",\"title\":\"Creator of Sass and Haml\"},{\"quote\":\"A breath of fresh air in the CMS world, once you go headless with butter you'll never go back.\",\"name\":\"Bryan MacMillan\",\"title\":\"IT Admin\"},{\"quote\":\"I was able to quickly draft new pages, circulate them to the team, edit them, and then ultimately publish intuitively.\",\"name\":\"Kim Kohatsu\",\"title\":\"CMO\"}]}}]}}}", + "object": { + "data": { + "slug": "landing-page-with-components", + "name": "Landing Page with Components", + "published": "2024-05-17T14:14:41.484894Z", + "updated": "2024-05-17T14:14:41.522160Z", + "page_type": "landing-page", + "fields": { + "seo": { + "title": "Sample Landing Page with Components - powered by ButterCMS", + "description": "Sample Landing Page with Components - powered by ButterCMS" + }, + "body": [ + { + "type": "hero", + "fields": { + "headline": "Welcome to your ButterCMS Proof of Concept", + "subheadline": "Use this app as your own proof of concept to explore Butter's capabilities for yourself. When you're ready, host this app and invite your team to try it out all well!", + "image": "https://cdn.buttercms.com/DVG5DLMQ9ywaCwfEAgL2", + "button_label": "Update this Page in Butter", + "button_url": "https://buttercms.com/pages/", + "scroll_anchor_id": "home" + } + }, + { + "type": "two_column_with_image", + "fields": { + "headline": "ButterCMS is your content backend", + "subheadline": "Butter has three core content solutions: Pages, Posts, and Collections. Combine this with advanced capabilities like localization, Write API, multi-site + multi-env and Butter is your centralized content backend no matter how much content you're managing.", + "image": "https://cdn.buttercms.com/yg7mFNnNSpyXLpwvp0KX", + "image_position": "left", + "button_label": "Update this Page in Butter", + "button_url": "https://buttercms.com/pages/", + "scroll_anchor_id": "about" + } + }, + { + "type": "features", + "fields": { + "headline": "This page is built using ButterCMS Components", + "subheadline": "This page is an example of utilizing Butter Components which allow you to build dynamic landing pages by choosing Components from a Component Library. Reuse and reorder Components in any way you want!", + "scroll_anchor_id": "features", + "features": [ + { + "headline": "Components on this page", + "description": "This sample page has four component types: hero, two column with image, features, and testimonials.", + "icon": "https://cdn.buttercms.com/1evWeDvPQ3eby8N5pZsg" + }, + { + "headline": "Build your own", + "description": "This page is just an example set of Components. You can build your own custom Component library!", + "icon": "https://cdn.buttercms.com/WX5OIKIPQAmu0YCAjZpH" + }, + { + "headline": "Reorder them", + "description": "Components are great because you can reorder them from your Butter dashboard", + "icon": "https://cdn.buttercms.com/h2nnt9PZSbaj20FLScbP" + }, + { + "headline": "Infinite possibilities", + "description": "Build carousels, call to actions, testimonials, and much more. There's infinite flexbility.", + "icon": "https://cdn.buttercms.com/FwNLtx6dR7ybtG1WenrK" + } + ] + } + }, + { + "type": "two_column_with_image", + "fields": { + "headline": "Customize this page", + "subheadline": "Try updating the content of this page to reflect your own. You can also explore modifying these components or creating your own in your Butter dashboard. Learn more about Page Types and Components.
", + "image": "https://cdn.buttercms.com/AJPaLE3ToKRoLwWQeaww", + "image_position": "right", + "button_label": "Update this Page in Butter", + "button_url": "https://buttercms.com/pages/", + "scroll_anchor_id": "tryit" + } + }, + { + "type": "testimonials", + "fields": { + "headline": "What our customers say", + "scroll_anchor_id": "testimonials", + "testimonial": [ + { + "quote": "Super Flexible CMS Solution", + "name": "Hampton Catlin", + "title": "Creator of Sass and Haml" + }, + { + "quote": "A breath of fresh air in the CMS world, once you go headless with butter you'll never go back.", + "name": "Bryan MacMillan", + "title": "IT Admin" + }, + { + "quote": "I was able to quickly draft new pages, circulate them to the team, edit them, and then ultimately publish intuitively.", + "name": "Kim Kohatsu", + "title": "CMO" + } + ] + } + } + ] + } + } + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/pages/test_page_get_invalid_token.json b/butter_cms/tests/fixtures/pages/test_page_get_invalid_token.json new file mode 100644 index 0000000..011992a --- /dev/null +++ b/butter_cms/tests/fixtures/pages/test_page_get_invalid_token.json @@ -0,0 +1,97 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/pages/landing-page/landing-page-with-components/", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 401, + "message": "Unauthorized" + }, + "headers": { + "Allow": [ + "GET, PUT, PATCH, HEAD, OPTIONS" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Connection": [ + "keep-alive" + ], + "Date": [ + "Mon, 20 May 2024 13:58:45 GMT" + ], + "Www-Authenticate": [ + "Token" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "X-Cache": [ + "MISS, MISS" + ], + "X-Frame-Options": [ + "DENY" + ], + "Accept-Ranges": [ + "bytes" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "X-Served-By": [ + "cache-iad-kjyo7100123-IAD, cache-vie6361-VIE" + ], + "Vary": [ + "Origin" + ], + "X-Timer": [ + "S1716213526.634227,VS0,VE125" + ], + "Referrer-Policy": [ + "same-origin" + ], + "Content-Type": [ + "application/json" + ], + "Content-Length": [ + "27" + ] + }, + "body": { + "string": "{\"detail\":\"Invalid token.\"}", + "object": { + "detail": "Invalid token." + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/pages/test_page_get_non_existent.json b/butter_cms/tests/fixtures/pages/test_page_get_non_existent.json new file mode 100644 index 0000000..1bfdcc3 --- /dev/null +++ b/butter_cms/tests/fixtures/pages/test_page_get_non_existent.json @@ -0,0 +1,97 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/pages/page_type/non-existent/", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 404, + "message": "Not Found" + }, + "headers": { + "Allow": [ + "GET, PUT, PATCH, HEAD, OPTIONS" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Connection": [ + "keep-alive" + ], + "Age": [ + "67" + ], + "Date": [ + "Mon, 20 May 2024 13:58:45 GMT" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "X-Cache": [ + "MISS, HIT" + ], + "X-Frame-Options": [ + "DENY" + ], + "Accept-Ranges": [ + "bytes" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "X-Served-By": [ + "cache-iad-kiad7000067-IAD, cache-vie6352-VIE" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "X-Timer": [ + "S1716213525.366679,VS0,VE1" + ], + "Referrer-Policy": [ + "same-origin" + ], + "Content-Type": [ + "application/json" + ], + "content-length": [ + "28" + ] + }, + "body": { + "string": "{\"detail\":\"Page not found.\"}", + "object": { + "detail": "Page not found." + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/pages/test_page_search.json b/butter_cms/tests/fixtures/pages/test_page_search.json new file mode 100644 index 0000000..d7c09a8 --- /dev/null +++ b/butter_cms/tests/fixtures/pages/test_page_search.json @@ -0,0 +1,207 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/pages/search/?query=sample+landing+page", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-Content-Type-Options": [ + "nosniff" + ], + "Age": [ + "0" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "content-length": [ + "3752" + ], + "Connection": [ + "keep-alive" + ], + "Date": [ + "Mon, 20 May 2024 14:02:11 GMT" + ], + "X-Cache": [ + "MISS, MISS" + ], + "Accept-Ranges": [ + "bytes" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Referrer-Policy": [ + "same-origin" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "X-Frame-Options": [ + "DENY" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "X-Served-By": [ + "cache-iad-kjyo7100095-IAD, cache-vie6372-VIE" + ], + "X-Timer": [ + "S1716213732.755866,VS0,VE136" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "Content-Type": [ + "application/json" + ] + }, + "body": { + "string": "{\"meta\":{\"next_page\":null,\"previous_page\":null,\"count\":1},\"data\":[{\"slug\":\"landing-page-with-components\",\"name\":\"Landing Page with Components\",\"published\":\"2024-05-17T14:14:41.484894Z\",\"updated\":\"2024-05-17T14:14:41.522160Z\",\"page_type\":\"landing-page\",\"fields\":{\"seo\":{\"title\":\"Sample Landing Page with Components - powered by ButterCMS\",\"description\":\"Sample Landing Page with Components - powered by ButterCMS\"},\"body\":[{\"type\":\"hero\",\"fields\":{\"headline\":\"Welcome to your ButterCMS Proof of Concept\",\"subheadline\":\"Use this app as your own proof of concept to explore Butter's capabilities for yourself. When you're ready, host this app and invite your team to try it out all well!\",\"image\":\"https://cdn.buttercms.com/DVG5DLMQ9ywaCwfEAgL2\",\"button_label\":\"Update this Page in Butter\",\"button_url\":\"https://buttercms.com/pages/\",\"scroll_anchor_id\":\"home\"}},{\"type\":\"two_column_with_image\",\"fields\":{\"headline\":\"ButterCMS is your content backend\",\"subheadline\":\"Butter has three core content solutions: Pages, Posts, and Collections. Combine this with advanced capabilities like localization, Write API, multi-site + multi-env and Butter is your centralized content backend no matter how much content you're managing.\",\"image\":\"https://cdn.buttercms.com/yg7mFNnNSpyXLpwvp0KX\",\"image_position\":\"left\",\"button_label\":\"Update this Page in Butter\",\"button_url\":\"https://buttercms.com/pages/\",\"scroll_anchor_id\":\"about\"}},{\"type\":\"features\",\"fields\":{\"headline\":\"This page is built using ButterCMS Components\",\"subheadline\":\"This page is an example of utilizing Butter Components which allow you to build dynamic landing pages by choosing Components from a Component Library. Reuse and reorder Components in any way you want!\",\"scroll_anchor_id\":\"features\",\"features\":[{\"headline\":\"Components on this page\",\"description\":\"This sample page has four component types: hero, two column with image, features, and testimonials.\",\"icon\":\"https://cdn.buttercms.com/1evWeDvPQ3eby8N5pZsg\"},{\"headline\":\"Build your own\",\"description\":\"This page is just an example set of Components. You can build your own custom Component library!\",\"icon\":\"https://cdn.buttercms.com/WX5OIKIPQAmu0YCAjZpH\"},{\"headline\":\"Reorder them\",\"description\":\"Components are great because you can reorder them from your Butter dashboard\",\"icon\":\"https://cdn.buttercms.com/h2nnt9PZSbaj20FLScbP\"},{\"headline\":\"Infinite possibilities\",\"description\":\"Build carousels, call to actions, testimonials, and much more. There's infinite flexbility.\",\"icon\":\"https://cdn.buttercms.com/FwNLtx6dR7ybtG1WenrK\"}]}},{\"type\":\"two_column_with_image\",\"fields\":{\"headline\":\"Customize this page\",\"subheadline\":\"Try updating the content of this page to reflect your own. You can also explore modifying these components or creating your own in your Butter dashboard. Learn more about Page Types and Components.
\",\"image\":\"https://cdn.buttercms.com/AJPaLE3ToKRoLwWQeaww\",\"image_position\":\"right\",\"button_label\":\"Update this Page in Butter\",\"button_url\":\"https://buttercms.com/pages/\",\"scroll_anchor_id\":\"tryit\"}},{\"type\":\"testimonials\",\"fields\":{\"headline\":\"What our customers say\",\"scroll_anchor_id\":\"testimonials\",\"testimonial\":[{\"quote\":\"Super Flexible CMS Solution\",\"name\":\"Hampton Catlin\",\"title\":\"Creator of Sass and Haml\"},{\"quote\":\"A breath of fresh air in the CMS world, once you go headless with butter you'll never go back.\",\"name\":\"Bryan MacMillan\",\"title\":\"IT Admin\"},{\"quote\":\"I was able to quickly draft new pages, circulate them to the team, edit them, and then ultimately publish intuitively.\",\"name\":\"Kim Kohatsu\",\"title\":\"CMO\"}]}}]}}]}", + "object": { + "meta": { + "next_page": null, + "previous_page": null, + "count": 1 + }, + "data": [ + { + "slug": "landing-page-with-components", + "name": "Landing Page with Components", + "published": "2024-05-17T14:14:41.484894Z", + "updated": "2024-05-17T14:14:41.522160Z", + "page_type": "landing-page", + "fields": { + "seo": { + "title": "Sample Landing Page with Components - powered by ButterCMS", + "description": "Sample Landing Page with Components - powered by ButterCMS" + }, + "body": [ + { + "type": "hero", + "fields": { + "headline": "Welcome to your ButterCMS Proof of Concept", + "subheadline": "Use this app as your own proof of concept to explore Butter's capabilities for yourself. When you're ready, host this app and invite your team to try it out all well!", + "image": "https://cdn.buttercms.com/DVG5DLMQ9ywaCwfEAgL2", + "button_label": "Update this Page in Butter", + "button_url": "https://buttercms.com/pages/", + "scroll_anchor_id": "home" + } + }, + { + "type": "two_column_with_image", + "fields": { + "headline": "ButterCMS is your content backend", + "subheadline": "Butter has three core content solutions: Pages, Posts, and Collections. Combine this with advanced capabilities like localization, Write API, multi-site + multi-env and Butter is your centralized content backend no matter how much content you're managing.", + "image": "https://cdn.buttercms.com/yg7mFNnNSpyXLpwvp0KX", + "image_position": "left", + "button_label": "Update this Page in Butter", + "button_url": "https://buttercms.com/pages/", + "scroll_anchor_id": "about" + } + }, + { + "type": "features", + "fields": { + "headline": "This page is built using ButterCMS Components", + "subheadline": "This page is an example of utilizing Butter Components which allow you to build dynamic landing pages by choosing Components from a Component Library. Reuse and reorder Components in any way you want!", + "scroll_anchor_id": "features", + "features": [ + { + "headline": "Components on this page", + "description": "This sample page has four component types: hero, two column with image, features, and testimonials.", + "icon": "https://cdn.buttercms.com/1evWeDvPQ3eby8N5pZsg" + }, + { + "headline": "Build your own", + "description": "This page is just an example set of Components. You can build your own custom Component library!", + "icon": "https://cdn.buttercms.com/WX5OIKIPQAmu0YCAjZpH" + }, + { + "headline": "Reorder them", + "description": "Components are great because you can reorder them from your Butter dashboard", + "icon": "https://cdn.buttercms.com/h2nnt9PZSbaj20FLScbP" + }, + { + "headline": "Infinite possibilities", + "description": "Build carousels, call to actions, testimonials, and much more. There's infinite flexbility.", + "icon": "https://cdn.buttercms.com/FwNLtx6dR7ybtG1WenrK" + } + ] + } + }, + { + "type": "two_column_with_image", + "fields": { + "headline": "Customize this page", + "subheadline": "Try updating the content of this page to reflect your own. You can also explore modifying these components or creating your own in your Butter dashboard. Learn more about Page Types and Components.
", + "image": "https://cdn.buttercms.com/AJPaLE3ToKRoLwWQeaww", + "image_position": "right", + "button_label": "Update this Page in Butter", + "button_url": "https://buttercms.com/pages/", + "scroll_anchor_id": "tryit" + } + }, + { + "type": "testimonials", + "fields": { + "headline": "What our customers say", + "scroll_anchor_id": "testimonials", + "testimonial": [ + { + "quote": "Super Flexible CMS Solution", + "name": "Hampton Catlin", + "title": "Creator of Sass and Haml" + }, + { + "quote": "A breath of fresh air in the CMS world, once you go headless with butter you'll never go back.", + "name": "Bryan MacMillan", + "title": "IT Admin" + }, + { + "quote": "I was able to quickly draft new pages, circulate them to the team, edit them, and then ultimately publish intuitively.", + "name": "Kim Kohatsu", + "title": "CMO" + } + ] + } + } + ] + } + } + ] + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/pages/test_page_search_invalid_token.json b/butter_cms/tests/fixtures/pages/test_page_search_invalid_token.json new file mode 100644 index 0000000..ce029d2 --- /dev/null +++ b/butter_cms/tests/fixtures/pages/test_page_search_invalid_token.json @@ -0,0 +1,97 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/pages/search/?query=sample+landing+page", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 401, + "message": "Unauthorized" + }, + "headers": { + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Content-Length": [ + "27" + ], + "Connection": [ + "keep-alive" + ], + "Date": [ + "Mon, 20 May 2024 14:02:11 GMT" + ], + "X-Cache": [ + "MISS, MISS" + ], + "Accept-Ranges": [ + "bytes" + ], + "Www-Authenticate": [ + "Token" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Referrer-Policy": [ + "same-origin" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "X-Frame-Options": [ + "DENY" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "X-Served-By": [ + "cache-iad-kiad7000129-IAD, cache-vie6334-VIE" + ], + "X-Timer": [ + "S1716213732.563924,VS0,VE126" + ], + "Vary": [ + "Origin" + ], + "Content-Type": [ + "application/json" + ] + }, + "body": { + "string": "{\"detail\":\"Invalid token.\"}", + "object": { + "detail": "Invalid token." + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/posts/test_post_all.json b/butter_cms/tests/fixtures/posts/test_post_all.json new file mode 100644 index 0000000..5809cdc --- /dev/null +++ b/butter_cms/tests/fixtures/posts/test_post_all.json @@ -0,0 +1,144 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/posts/", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-Frame-Options": [ + "DENY" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Allow": [ + "GET, POST, HEAD, OPTIONS" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Content-Type": [ + "application/json" + ], + "Age": [ + "0" + ], + "X-Cache": [ + "MISS, MISS" + ], + "Accept-Ranges": [ + "bytes" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Date": [ + "Mon, 20 May 2024 14:04:12 GMT" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "X-Served-By": [ + "cache-iad-kiad7000032-IAD, cache-vie6378-VIE" + ], + "content-length": [ + "3163" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "Referrer-Policy": [ + "same-origin" + ], + "X-Timer": [ + "S1716213852.451032,VS0,VE160" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Connection": [ + "keep-alive" + ] + }, + "body": { + "string": "{\"meta\":{\"next_page\":null,\"previous_page\":null,\"count\":1},\"data\":[{\"status\":\"published\",\"created\":\"2024-05-17T14:13:46.787544Z\",\"updated\":\"2024-05-17T14:13:46.813008Z\",\"published\":\"2024-05-17T14:13:46.787109Z\",\"title\":\"Example Post\",\"slug\":\"example-post\",\"body\":\"Welcome to ButterCMS! This an example blog post written using Butter.
\\nHere's a helpful walkthrough of our Blog Engine solution.
\\n\\n\\n\\n
If you're viewing this post from your website or command line, you've successfully made a request to the Butter API. If you haven't already, make sure you have our development guides pulled up for step-by-step instructions on setting up Butter.
\\nButter's WYSIWYG editor supports standard text formatting including headings, links, quotes, code, text alignment, and more. You can upload, crop, and resize images which are automatically hosted and delivered through a CDN (see below). You can also edit HTML directly when needed.
\\nYes. Butter can be used as a full CMS for managing dynamic content and creating pages across your entire website or app. Check out our development guides for step-by-step tutorials on setting this up.
\\n\",\"summary\":\"This is an example blog post. Pretty neat huh?\",\"seo_title\":\"Example Post SEO Optimized Title\",\"meta_description\":\"This is our example blog posts SEO optimized meta description.\",\"featured_image_alt\":\"\",\"url\":\"/example-post\",\"featured_image\":\"https://cdn.buttercms.com/WUkiXJ6RCqZmjR8xihEL\",\"author\":{\"bio\":\"\",\"slug\":\"sdk-tests\",\"email\":\"sdktests@buttercms.com\",\"title\":\"\",\"last_name\":\"Tests\",\"first_name\":\"SDK\",\"facebook_url\":\"\",\"linkedin_url\":\"\",\"instagram_url\":\"\",\"pinterest_url\":\"\",\"profile_image\":\"\",\"twitter_handle\":\"\"},\"tags\":[{\"name\":\"Example Tag\",\"slug\":\"example-tag\"}],\"categories\":[{\"name\":\"Example Category\",\"slug\":\"example-category\"}]}]}", + "object": { + "meta": { + "next_page": null, + "previous_page": null, + "count": 1 + }, + "data": [ + { + "status": "published", + "created": "2024-05-17T14:13:46.787544Z", + "updated": "2024-05-17T14:13:46.813008Z", + "published": "2024-05-17T14:13:46.787109Z", + "title": "Example Post", + "slug": "example-post", + "body": "Welcome to ButterCMS! This an example blog post written using Butter.
\nHere's a helpful walkthrough of our Blog Engine solution.
\n\n\n\n
If you're viewing this post from your website or command line, you've successfully made a request to the Butter API. If you haven't already, make sure you have our development guides pulled up for step-by-step instructions on setting up Butter.
\nButter's WYSIWYG editor supports standard text formatting including headings, links, quotes, code, text alignment, and more. You can upload, crop, and resize images which are automatically hosted and delivered through a CDN (see below). You can also edit HTML directly when needed.
\nYes. Butter can be used as a full CMS for managing dynamic content and creating pages across your entire website or app. Check out our development guides for step-by-step tutorials on setting this up.
\n", + "summary": "This is an example blog post. Pretty neat huh?", + "seo_title": "Example Post SEO Optimized Title", + "meta_description": "This is our example blog posts SEO optimized meta description.", + "featured_image_alt": "", + "url": "/example-post", + "featured_image": "https://cdn.buttercms.com/WUkiXJ6RCqZmjR8xihEL", + "author": { + "bio": "", + "slug": "sdk-tests", + "email": "sdktests@buttercms.com", + "title": "", + "last_name": "Tests", + "first_name": "SDK", + "facebook_url": "", + "linkedin_url": "", + "instagram_url": "", + "pinterest_url": "", + "profile_image": "", + "twitter_handle": "" + }, + "tags": [ + { + "name": "Example Tag", + "slug": "example-tag" + } + ], + "categories": [ + { + "name": "Example Category", + "slug": "example-category" + } + ] + } + ] + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/posts/test_post_all_exclude_body.json b/butter_cms/tests/fixtures/posts/test_post_all_exclude_body.json new file mode 100644 index 0000000..04566df --- /dev/null +++ b/butter_cms/tests/fixtures/posts/test_post_all_exclude_body.json @@ -0,0 +1,143 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/posts/?exclude_body=True", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-Frame-Options": [ + "DENY" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Allow": [ + "GET, POST, HEAD, OPTIONS" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Content-Type": [ + "application/json" + ], + "Age": [ + "0" + ], + "X-Cache": [ + "MISS, MISS" + ], + "Accept-Ranges": [ + "bytes" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Date": [ + "Mon, 20 May 2024 14:04:12 GMT" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "X-Served-By": [ + "cache-iad-kjyo7100128-IAD, cache-vie6334-VIE" + ], + "content-length": [ + "916" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "Referrer-Policy": [ + "same-origin" + ], + "X-Timer": [ + "S1716213853.674047,VS0,VE143" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Connection": [ + "keep-alive" + ] + }, + "body": { + "string": "{\"meta\":{\"next_page\":null,\"previous_page\":null,\"count\":1},\"data\":[{\"status\":\"published\",\"created\":\"2024-05-17T14:13:46.787544Z\",\"updated\":\"2024-05-17T14:13:46.813008Z\",\"published\":\"2024-05-17T14:13:46.787109Z\",\"title\":\"Example Post\",\"slug\":\"example-post\",\"summary\":\"This is an example blog post. Pretty neat huh?\",\"seo_title\":\"Example Post SEO Optimized Title\",\"meta_description\":\"This is our example blog posts SEO optimized meta description.\",\"featured_image_alt\":\"\",\"url\":\"/example-post\",\"featured_image\":\"https://cdn.buttercms.com/WUkiXJ6RCqZmjR8xihEL\",\"author\":{\"bio\":\"\",\"slug\":\"sdk-tests\",\"email\":\"sdktests@buttercms.com\",\"title\":\"\",\"last_name\":\"Tests\",\"first_name\":\"SDK\",\"facebook_url\":\"\",\"linkedin_url\":\"\",\"instagram_url\":\"\",\"pinterest_url\":\"\",\"profile_image\":\"\",\"twitter_handle\":\"\"},\"tags\":[{\"name\":\"Example Tag\",\"slug\":\"example-tag\"}],\"categories\":[{\"name\":\"Example Category\",\"slug\":\"example-category\"}]}]}", + "object": { + "meta": { + "next_page": null, + "previous_page": null, + "count": 1 + }, + "data": [ + { + "status": "published", + "created": "2024-05-17T14:13:46.787544Z", + "updated": "2024-05-17T14:13:46.813008Z", + "published": "2024-05-17T14:13:46.787109Z", + "title": "Example Post", + "slug": "example-post", + "summary": "This is an example blog post. Pretty neat huh?", + "seo_title": "Example Post SEO Optimized Title", + "meta_description": "This is our example blog posts SEO optimized meta description.", + "featured_image_alt": "", + "url": "/example-post", + "featured_image": "https://cdn.buttercms.com/WUkiXJ6RCqZmjR8xihEL", + "author": { + "bio": "", + "slug": "sdk-tests", + "email": "sdktests@buttercms.com", + "title": "", + "last_name": "Tests", + "first_name": "SDK", + "facebook_url": "", + "linkedin_url": "", + "instagram_url": "", + "pinterest_url": "", + "profile_image": "", + "twitter_handle": "" + }, + "tags": [ + { + "name": "Example Tag", + "slug": "example-tag" + } + ], + "categories": [ + { + "name": "Example Category", + "slug": "example-category" + } + ] + } + ] + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/posts/test_post_all_invalid_token.json b/butter_cms/tests/fixtures/posts/test_post_all_invalid_token.json new file mode 100644 index 0000000..8eb98a8 --- /dev/null +++ b/butter_cms/tests/fixtures/posts/test_post_all_invalid_token.json @@ -0,0 +1,97 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/posts/", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 401, + "message": "Unauthorized" + }, + "headers": { + "X-Frame-Options": [ + "DENY" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Allow": [ + "GET, POST, HEAD, OPTIONS" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Content-Type": [ + "application/json" + ], + "X-Cache": [ + "MISS, MISS" + ], + "Accept-Ranges": [ + "bytes" + ], + "Www-Authenticate": [ + "Token" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Date": [ + "Mon, 20 May 2024 14:04:12 GMT" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "X-Served-By": [ + "cache-iad-kiad7000165-IAD, cache-vie6377-VIE" + ], + "Content-Length": [ + "27" + ], + "Vary": [ + "Origin" + ], + "Referrer-Policy": [ + "same-origin" + ], + "X-Timer": [ + "S1716213852.268802,VS0,VE124" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Connection": [ + "keep-alive" + ] + }, + "body": { + "string": "{\"detail\":\"Invalid token.\"}", + "object": { + "detail": "Invalid token." + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/posts/test_post_get.json b/butter_cms/tests/fixtures/posts/test_post_get.json new file mode 100644 index 0000000..46d7197 --- /dev/null +++ b/butter_cms/tests/fixtures/posts/test_post_get.json @@ -0,0 +1,142 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/posts/example-post/", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Allow": [ + "GET, PUT, PATCH, DELETE, HEAD, OPTIONS" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "X-Served-By": [ + "cache-iad-kjyo7100055-IAD, cache-vie6368-VIE" + ], + "X-Timer": [ + "S1716213976.365691,VS0,VE251" + ], + "Date": [ + "Mon, 20 May 2024 14:06:16 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Content-Type": [ + "application/json" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Connection": [ + "keep-alive" + ], + "Referrer-Policy": [ + "same-origin" + ], + "content-length": [ + "3155" + ], + "Age": [ + "0" + ], + "X-Cache": [ + "MISS, MISS" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "X-Frame-Options": [ + "DENY" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "Accept-Ranges": [ + "bytes" + ] + }, + "body": { + "string": "{\"meta\":{\"next_post\":null,\"previous_post\":null},\"data\":{\"created\":\"2024-05-17T14:13:46.787544Z\",\"published\":\"2024-05-17T14:13:46.787109Z\",\"url\":null,\"slug\":\"example-post\",\"featured_image\":\"https://cdn.buttercms.com/WUkiXJ6RCqZmjR8xihEL\",\"featured_image_alt\":\"\",\"author\":{\"first_name\":\"SDK\",\"last_name\":\"Tests\",\"email\":\"sdktests@buttercms.com\",\"slug\":\"sdk-tests\",\"bio\":\"\",\"title\":\"\",\"linkedin_url\":\"\",\"facebook_url\":\"\",\"instagram_url\":\"\",\"pinterest_url\":\"\",\"twitter_handle\":\"\",\"profile_image\":\"\"},\"tags\":[{\"name\":\"Example Tag\",\"slug\":\"example-tag\"}],\"categories\":[{\"name\":\"Example Category\",\"slug\":\"example-category\"}],\"title\":\"Example Post\",\"body\":\"Welcome to ButterCMS! This an example blog post written using Butter.
\\nHere's a helpful walkthrough of our Blog Engine solution.
\\n\\n\\n\\n
If you're viewing this post from your website or command line, you've successfully made a request to the Butter API. If you haven't already, make sure you have our development guides pulled up for step-by-step instructions on setting up Butter.
\\nButter's WYSIWYG editor supports standard text formatting including headings, links, quotes, code, text alignment, and more. You can upload, crop, and resize images which are automatically hosted and delivered through a CDN (see below). You can also edit HTML directly when needed.
\\nYes. Butter can be used as a full CMS for managing dynamic content and creating pages across your entire website or app. Check out our development guides for step-by-step tutorials on setting this up.
\\n\",\"summary\":\"This is an example blog post. Pretty neat huh?\",\"updated\":\"2024-05-17T14:13:46.813008Z\",\"deleted\":null,\"seo_title\":\"Example Post SEO Optimized Title\",\"meta_description\":\"This is our example blog posts SEO optimized meta description.\",\"status\":\"published\"}}", + "object": { + "meta": { + "next_post": null, + "previous_post": null + }, + "data": { + "created": "2024-05-17T14:13:46.787544Z", + "published": "2024-05-17T14:13:46.787109Z", + "url": null, + "slug": "example-post", + "featured_image": "https://cdn.buttercms.com/WUkiXJ6RCqZmjR8xihEL", + "featured_image_alt": "", + "author": { + "first_name": "SDK", + "last_name": "Tests", + "email": "sdktests@buttercms.com", + "slug": "sdk-tests", + "bio": "", + "title": "", + "linkedin_url": "", + "facebook_url": "", + "instagram_url": "", + "pinterest_url": "", + "twitter_handle": "", + "profile_image": "" + }, + "tags": [ + { + "name": "Example Tag", + "slug": "example-tag" + } + ], + "categories": [ + { + "name": "Example Category", + "slug": "example-category" + } + ], + "title": "Example Post", + "body": "Welcome to ButterCMS! This an example blog post written using Butter.
\nHere's a helpful walkthrough of our Blog Engine solution.
\n\n\n\n
If you're viewing this post from your website or command line, you've successfully made a request to the Butter API. If you haven't already, make sure you have our development guides pulled up for step-by-step instructions on setting up Butter.
\nButter's WYSIWYG editor supports standard text formatting including headings, links, quotes, code, text alignment, and more. You can upload, crop, and resize images which are automatically hosted and delivered through a CDN (see below). You can also edit HTML directly when needed.
\nYes. Butter can be used as a full CMS for managing dynamic content and creating pages across your entire website or app. Check out our development guides for step-by-step tutorials on setting this up.
\n", + "summary": "This is an example blog post. Pretty neat huh?", + "updated": "2024-05-17T14:13:46.813008Z", + "deleted": null, + "seo_title": "Example Post SEO Optimized Title", + "meta_description": "This is our example blog posts SEO optimized meta description.", + "status": "published" + } + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/posts/test_post_get_invalid_token.json b/butter_cms/tests/fixtures/posts/test_post_get_invalid_token.json new file mode 100644 index 0000000..9a678ff --- /dev/null +++ b/butter_cms/tests/fixtures/posts/test_post_get_invalid_token.json @@ -0,0 +1,97 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/posts/example-post/", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 401, + "message": "Unauthorized" + }, + "headers": { + "Allow": [ + "GET, PUT, PATCH, DELETE, HEAD, OPTIONS" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "X-Served-By": [ + "cache-iad-kjyo7100057-IAD, cache-vie6326-VIE" + ], + "X-Timer": [ + "S1716213977.679801,VS0,VE142" + ], + "Date": [ + "Mon, 20 May 2024 14:06:16 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Content-Type": [ + "application/json" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Connection": [ + "keep-alive" + ], + "Referrer-Policy": [ + "same-origin" + ], + "Content-Length": [ + "27" + ], + "X-Cache": [ + "MISS, MISS" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "X-Frame-Options": [ + "DENY" + ], + "Vary": [ + "Origin" + ], + "Www-Authenticate": [ + "Token" + ], + "Accept-Ranges": [ + "bytes" + ] + }, + "body": { + "string": "{\"detail\":\"Invalid token.\"}", + "object": { + "detail": "Invalid token." + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/posts/test_post_get_not_existent.json b/butter_cms/tests/fixtures/posts/test_post_get_not_existent.json new file mode 100644 index 0000000..25cb764 --- /dev/null +++ b/butter_cms/tests/fixtures/posts/test_post_get_not_existent.json @@ -0,0 +1,97 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/posts/non-existent/", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 404, + "message": "Not Found" + }, + "headers": { + "Allow": [ + "GET, PUT, PATCH, DELETE, HEAD, OPTIONS" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "X-Served-By": [ + "cache-iad-kjyo7100020-IAD, cache-vie6323-VIE" + ], + "X-Timer": [ + "S1716213976.165223,VS0,VE132" + ], + "Date": [ + "Mon, 20 May 2024 14:06:16 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Content-Type": [ + "application/json" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Connection": [ + "keep-alive" + ], + "Referrer-Policy": [ + "same-origin" + ], + "content-length": [ + "23" + ], + "Age": [ + "0" + ], + "X-Cache": [ + "MISS, MISS" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "X-Frame-Options": [ + "DENY" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "Accept-Ranges": [ + "bytes" + ] + }, + "body": { + "string": "{\"detail\":\"Not found.\"}", + "object": { + "detail": "Not found." + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/posts/test_post_search.json b/butter_cms/tests/fixtures/posts/test_post_search.json new file mode 100644 index 0000000..1fdcfac --- /dev/null +++ b/butter_cms/tests/fixtures/posts/test_post_search.json @@ -0,0 +1,146 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/posts/search/?query=example+blog+post", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-Content-Type-Options": [ + "nosniff" + ], + "content-length": [ + "3185" + ], + "X-Cache": [ + "MISS, MISS" + ], + "X-Frame-Options": [ + "DENY" + ], + "X-Served-By": [ + "cache-iad-kiad7000053-IAD, cache-vie6320-VIE" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Accept-Ranges": [ + "bytes" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Age": [ + "0" + ], + "Connection": [ + "keep-alive" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Referrer-Policy": [ + "same-origin" + ], + "Date": [ + "Mon, 20 May 2024 14:09:14 GMT" + ], + "Content-Type": [ + "application/json" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "X-Timer": [ + "S1716214155.801497,VS0,VE152" + ], + "X-Cache-Hits": [ + "0, 0" + ] + }, + "body": { + "string": "{\"meta\":{\"next_page\":null,\"previous_page\":null,\"count\":1},\"data\":[{\"created\":\"2024-05-17T14:13:46.787544Z\",\"published\":\"2024-05-17T14:13:46.787109Z\",\"url\":null,\"slug\":\"example-post\",\"featured_image\":\"https://cdn.buttercms.com/WUkiXJ6RCqZmjR8xihEL\",\"featured_image_alt\":\"\",\"author\":{\"first_name\":\"SDK\",\"last_name\":\"Tests\",\"email\":\"sdktests@buttercms.com\",\"slug\":\"sdk-tests\",\"bio\":\"\",\"title\":\"\",\"linkedin_url\":\"\",\"facebook_url\":\"\",\"instagram_url\":\"\",\"pinterest_url\":\"\",\"twitter_handle\":\"\",\"profile_image\":\"\"},\"tags\":[{\"name\":\"Example Tag\",\"slug\":\"example-tag\"}],\"categories\":[{\"name\":\"Example Category\",\"slug\":\"example-category\"}],\"rank\":0.24545455,\"title\":\"Example Post\",\"body\":\"Welcome to ButterCMS! This an example blog post written using Butter.
\\nHere's a helpful walkthrough of our Blog Engine solution.
\\n\\n\\n\\n
If you're viewing this post from your website or command line, you've successfully made a request to the Butter API. If you haven't already, make sure you have our development guides pulled up for step-by-step instructions on setting up Butter.
\\nButter's WYSIWYG editor supports standard text formatting including headings, links, quotes, code, text alignment, and more. You can upload, crop, and resize images which are automatically hosted and delivered through a CDN (see below). You can also edit HTML directly when needed.
\\nYes. Butter can be used as a full CMS for managing dynamic content and creating pages across your entire website or app. Check out our development guides for step-by-step tutorials on setting this up.
\\n\",\"summary\":\"This is an example blog post. Pretty neat huh?\",\"updated\":\"2024-05-17T14:13:46.813008Z\",\"deleted\":null,\"seo_title\":\"Example Post SEO Optimized Title\",\"meta_description\":\"This is our example blog posts SEO optimized meta description.\",\"status\":\"published\"}]}", + "object": { + "meta": { + "next_page": null, + "previous_page": null, + "count": 1 + }, + "data": [ + { + "created": "2024-05-17T14:13:46.787544Z", + "published": "2024-05-17T14:13:46.787109Z", + "url": null, + "slug": "example-post", + "featured_image": "https://cdn.buttercms.com/WUkiXJ6RCqZmjR8xihEL", + "featured_image_alt": "", + "author": { + "first_name": "SDK", + "last_name": "Tests", + "email": "sdktests@buttercms.com", + "slug": "sdk-tests", + "bio": "", + "title": "", + "linkedin_url": "", + "facebook_url": "", + "instagram_url": "", + "pinterest_url": "", + "twitter_handle": "", + "profile_image": "" + }, + "tags": [ + { + "name": "Example Tag", + "slug": "example-tag" + } + ], + "categories": [ + { + "name": "Example Category", + "slug": "example-category" + } + ], + "rank": 0.24545455, + "title": "Example Post", + "body": "Welcome to ButterCMS! This an example blog post written using Butter.
\nHere's a helpful walkthrough of our Blog Engine solution.
\n\n\n\n
If you're viewing this post from your website or command line, you've successfully made a request to the Butter API. If you haven't already, make sure you have our development guides pulled up for step-by-step instructions on setting up Butter.
\nButter's WYSIWYG editor supports standard text formatting including headings, links, quotes, code, text alignment, and more. You can upload, crop, and resize images which are automatically hosted and delivered through a CDN (see below). You can also edit HTML directly when needed.
\nYes. Butter can be used as a full CMS for managing dynamic content and creating pages across your entire website or app. Check out our development guides for step-by-step tutorials on setting this up.
\n", + "summary": "This is an example blog post. Pretty neat huh?", + "updated": "2024-05-17T14:13:46.813008Z", + "deleted": null, + "seo_title": "Example Post SEO Optimized Title", + "meta_description": "This is our example blog posts SEO optimized meta description.", + "status": "published" + } + ] + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/posts/test_post_search_invalid_token.json b/butter_cms/tests/fixtures/posts/test_post_search_invalid_token.json new file mode 100644 index 0000000..9bacb15 --- /dev/null +++ b/butter_cms/tests/fixtures/posts/test_post_search_invalid_token.json @@ -0,0 +1,97 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/posts/search/?query=example+post", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 401, + "message": "Unauthorized" + }, + "headers": { + "X-Content-Type-Options": [ + "nosniff" + ], + "Content-Length": [ + "27" + ], + "X-Cache": [ + "MISS, MISS" + ], + "X-Frame-Options": [ + "DENY" + ], + "X-Served-By": [ + "cache-iad-kcgs7200115-IAD, cache-vie6371-VIE" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Accept-Ranges": [ + "bytes" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Www-Authenticate": [ + "Token" + ], + "Connection": [ + "keep-alive" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Referrer-Policy": [ + "same-origin" + ], + "Date": [ + "Mon, 20 May 2024 14:09:14 GMT" + ], + "Content-Type": [ + "application/json" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "Vary": [ + "Origin" + ], + "X-Timer": [ + "S1716214155.625333,VS0,VE120" + ], + "X-Cache-Hits": [ + "0, 0" + ] + }, + "body": { + "string": "{\"detail\":\"Invalid token.\"}", + "object": { + "detail": "Invalid token." + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/tags/test_tag_all.json b/butter_cms/tests/fixtures/tags/test_tag_all.json new file mode 100644 index 0000000..23a26ce --- /dev/null +++ b/butter_cms/tests/fixtures/tags/test_tag_all.json @@ -0,0 +1,102 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/tags/", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "Content-Type": [ + "application/json" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Connection": [ + "keep-alive" + ], + "X-Frame-Options": [ + "DENY" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "X-Cache": [ + "MISS, MISS" + ], + "X-Timer": [ + "S1716214218.648069,VS0,VE135" + ], + "Age": [ + "0" + ], + "X-Served-By": [ + "cache-iad-kiad7000135-IAD, cache-vie6330-VIE" + ], + "content-length": [ + "54" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 20 May 2024 14:10:17 GMT" + ], + "Accept-Ranges": [ + "bytes" + ], + "Referrer-Policy": [ + "same-origin" + ] + }, + "body": { + "string": "{\"data\":[{\"name\":\"Example Tag\",\"slug\":\"example-tag\"}]}", + "object": { + "data": [ + { + "name": "Example Tag", + "slug": "example-tag" + } + ] + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/tags/test_tag_all_invalid_token.json b/butter_cms/tests/fixtures/tags/test_tag_all_invalid_token.json new file mode 100644 index 0000000..795f320 --- /dev/null +++ b/butter_cms/tests/fixtures/tags/test_tag_all_invalid_token.json @@ -0,0 +1,97 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/tags/", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 401, + "message": "Unauthorized" + }, + "headers": { + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Vary": [ + "Origin" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "Content-Type": [ + "application/json" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Connection": [ + "keep-alive" + ], + "X-Frame-Options": [ + "DENY" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "X-Cache": [ + "MISS, MISS" + ], + "X-Timer": [ + "S1716214217.464827,VS0,VE124" + ], + "X-Served-By": [ + "cache-iad-kcgs7200051-IAD, cache-vie6381-VIE" + ], + "Content-Length": [ + "27" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Www-Authenticate": [ + "Token" + ], + "Date": [ + "Mon, 20 May 2024 14:10:17 GMT" + ], + "Accept-Ranges": [ + "bytes" + ], + "Referrer-Policy": [ + "same-origin" + ] + }, + "body": { + "string": "{\"detail\":\"Invalid token.\"}", + "object": { + "detail": "Invalid token." + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/tags/test_tag_all_with_recent_posts.json b/butter_cms/tests/fixtures/tags/test_tag_all_with_recent_posts.json new file mode 100644 index 0000000..d9717a4 --- /dev/null +++ b/butter_cms/tests/fixtures/tags/test_tag_all_with_recent_posts.json @@ -0,0 +1,146 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/tags/?include=recent_posts", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "Content-Type": [ + "application/json" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Connection": [ + "keep-alive" + ], + "X-Frame-Options": [ + "DENY" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "X-Cache": [ + "MISS, MISS" + ], + "X-Timer": [ + "S1716214218.854856,VS0,VE143" + ], + "Age": [ + "0" + ], + "X-Served-By": [ + "cache-iad-kcgs7200107-IAD, cache-vie6325-VIE" + ], + "content-length": [ + "3171" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 20 May 2024 14:10:17 GMT" + ], + "Accept-Ranges": [ + "bytes" + ], + "Referrer-Policy": [ + "same-origin" + ] + }, + "body": { + "string": "{\"data\":[{\"name\":\"Example Tag\",\"slug\":\"example-tag\",\"recent_posts\":[{\"created\":\"2024-05-17T14:13:46.787544Z\",\"published\":\"2024-05-17T14:13:46.787109Z\",\"url\":null,\"slug\":\"example-post\",\"featured_image\":\"https://cdn.buttercms.com/WUkiXJ6RCqZmjR8xihEL\",\"featured_image_alt\":\"\",\"author\":{\"first_name\":\"SDK\",\"last_name\":\"Tests\",\"email\":\"sdktests@buttercms.com\",\"slug\":\"sdk-tests\",\"bio\":\"\",\"title\":\"\",\"linkedin_url\":\"\",\"facebook_url\":\"\",\"instagram_url\":\"\",\"pinterest_url\":\"\",\"twitter_handle\":\"\",\"profile_image\":\"\"},\"tags\":[{\"name\":\"Example Tag\",\"slug\":\"example-tag\"}],\"categories\":[{\"name\":\"Example Category\",\"slug\":\"example-category\"}],\"title\":\"Example Post\",\"body\":\"Welcome to ButterCMS! This an example blog post written using Butter.
\\nHere's a helpful walkthrough of our Blog Engine solution.
\\n\\n\\n\\n
If you're viewing this post from your website or command line, you've successfully made a request to the Butter API. If you haven't already, make sure you have our development guides pulled up for step-by-step instructions on setting up Butter.
\\nButter's WYSIWYG editor supports standard text formatting including headings, links, quotes, code, text alignment, and more. You can upload, crop, and resize images which are automatically hosted and delivered through a CDN (see below). You can also edit HTML directly when needed.
\\nYes. Butter can be used as a full CMS for managing dynamic content and creating pages across your entire website or app. Check out our development guides for step-by-step tutorials on setting this up.
\\n\",\"summary\":\"This is an example blog post. Pretty neat huh?\",\"updated\":\"2024-05-17T14:13:46.813008Z\",\"deleted\":null,\"seo_title\":\"Example Post SEO Optimized Title\",\"meta_description\":\"This is our example blog posts SEO optimized meta description.\",\"status\":\"published\"}]}]}", + "object": { + "data": [ + { + "name": "Example Tag", + "slug": "example-tag", + "recent_posts": [ + { + "created": "2024-05-17T14:13:46.787544Z", + "published": "2024-05-17T14:13:46.787109Z", + "url": null, + "slug": "example-post", + "featured_image": "https://cdn.buttercms.com/WUkiXJ6RCqZmjR8xihEL", + "featured_image_alt": "", + "author": { + "first_name": "SDK", + "last_name": "Tests", + "email": "sdktests@buttercms.com", + "slug": "sdk-tests", + "bio": "", + "title": "", + "linkedin_url": "", + "facebook_url": "", + "instagram_url": "", + "pinterest_url": "", + "twitter_handle": "", + "profile_image": "" + }, + "tags": [ + { + "name": "Example Tag", + "slug": "example-tag" + } + ], + "categories": [ + { + "name": "Example Category", + "slug": "example-category" + } + ], + "title": "Example Post", + "body": "Welcome to ButterCMS! This an example blog post written using Butter.
\nHere's a helpful walkthrough of our Blog Engine solution.
\n\n\n\n
If you're viewing this post from your website or command line, you've successfully made a request to the Butter API. If you haven't already, make sure you have our development guides pulled up for step-by-step instructions on setting up Butter.
\nButter's WYSIWYG editor supports standard text formatting including headings, links, quotes, code, text alignment, and more. You can upload, crop, and resize images which are automatically hosted and delivered through a CDN (see below). You can also edit HTML directly when needed.
\nYes. Butter can be used as a full CMS for managing dynamic content and creating pages across your entire website or app. Check out our development guides for step-by-step tutorials on setting this up.
\n", + "summary": "This is an example blog post. Pretty neat huh?", + "updated": "2024-05-17T14:13:46.813008Z", + "deleted": null, + "seo_title": "Example Post SEO Optimized Title", + "meta_description": "This is our example blog posts SEO optimized meta description.", + "status": "published" + } + ] + } + ] + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/tags/test_tag_get.json b/butter_cms/tests/fixtures/tags/test_tag_get.json new file mode 100644 index 0000000..d290b95 --- /dev/null +++ b/butter_cms/tests/fixtures/tags/test_tag_get.json @@ -0,0 +1,100 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/tags/example-tag", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Age": [ + "0" + ], + "Date": [ + "Mon, 20 May 2024 14:11:41 GMT" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "X-Served-By": [ + "cache-iad-kjyo7100103-IAD, cache-vie6370-VIE" + ], + "Accept-Ranges": [ + "bytes" + ], + "Referrer-Policy": [ + "same-origin" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Content-Type": [ + "application/json" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "content-length": [ + "52" + ], + "X-Cache": [ + "MISS, MISS" + ], + "Connection": [ + "keep-alive" + ], + "X-Frame-Options": [ + "DENY" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "X-Timer": [ + "S1716214301.948352,VS0,VE145" + ] + }, + "body": { + "string": "{\"data\":{\"name\":\"Example Tag\",\"slug\":\"example-tag\"}}", + "object": { + "data": { + "name": "Example Tag", + "slug": "example-tag" + } + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/tags/test_tag_get_invalid_token.json b/butter_cms/tests/fixtures/tags/test_tag_get_invalid_token.json new file mode 100644 index 0000000..e323330 --- /dev/null +++ b/butter_cms/tests/fixtures/tags/test_tag_get_invalid_token.json @@ -0,0 +1,97 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/tags/example-tag", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 401, + "message": "Unauthorized" + }, + "headers": { + "Date": [ + "Mon, 20 May 2024 14:11:41 GMT" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "X-Served-By": [ + "cache-iad-kcgs7200147-IAD, cache-vie6357-VIE" + ], + "Accept-Ranges": [ + "bytes" + ], + "Referrer-Policy": [ + "same-origin" + ], + "Vary": [ + "Origin" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Content-Type": [ + "application/json" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "Content-Length": [ + "27" + ], + "X-Cache": [ + "MISS, MISS" + ], + "Connection": [ + "keep-alive" + ], + "Www-Authenticate": [ + "Token" + ], + "X-Frame-Options": [ + "DENY" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "X-Timer": [ + "S1716214302.570753,VS0,VE124" + ] + }, + "body": { + "string": "{\"detail\":\"Invalid token.\"}", + "object": { + "detail": "Invalid token." + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/tags/test_tag_get_non_existent.json b/butter_cms/tests/fixtures/tags/test_tag_get_non_existent.json new file mode 100644 index 0000000..e632204 --- /dev/null +++ b/butter_cms/tests/fixtures/tags/test_tag_get_non_existent.json @@ -0,0 +1,97 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/tags/non-existent", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 404, + "message": "Not Found" + }, + "headers": { + "Age": [ + "0" + ], + "Date": [ + "Mon, 20 May 2024 14:11:40 GMT" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "X-Served-By": [ + "cache-iad-kiad7000110-IAD, cache-vie6339-VIE" + ], + "Accept-Ranges": [ + "bytes" + ], + "Referrer-Policy": [ + "same-origin" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Content-Type": [ + "application/json" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "content-length": [ + "23" + ], + "X-Cache": [ + "MISS, MISS" + ], + "Connection": [ + "keep-alive" + ], + "X-Frame-Options": [ + "DENY" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "X-Timer": [ + "S1716214301.736344,VS0,VE136" + ] + }, + "body": { + "string": "{\"detail\":\"Not found.\"}", + "object": { + "detail": "Not found." + } + } + } + } + ] +} diff --git a/butter_cms/tests/fixtures/tags/test_tag_get_with_recent_posts.json b/butter_cms/tests/fixtures/tags/test_tag_get_with_recent_posts.json new file mode 100644 index 0000000..65f6d39 --- /dev/null +++ b/butter_cms/tests/fixtures/tags/test_tag_get_with_recent_posts.json @@ -0,0 +1,144 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "GET", + "uri": "https://api.buttercms.com/v2/tags/example-tag?include=recent_posts", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "X-Butter-Client": [ + "Python/2.1.1" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Age": [ + "0" + ], + "Date": [ + "Mon, 20 May 2024 14:11:41 GMT" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "X-Served-By": [ + "cache-iad-kcgs7200093-IAD, cache-vie6324-VIE" + ], + "Accept-Ranges": [ + "bytes" + ], + "Referrer-Policy": [ + "same-origin" + ], + "Vary": [ + "Origin, Accept-Encoding" + ], + "X-Cache-Hits": [ + "0, 0" + ], + "Server": [ + "gunicorn/19.9.0" + ], + "Content-Type": [ + "application/json" + ], + "Allow": [ + "GET, HEAD, OPTIONS" + ], + "content-length": [ + "3169" + ], + "X-Cache": [ + "MISS, MISS" + ], + "Connection": [ + "keep-alive" + ], + "X-Frame-Options": [ + "DENY" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Via": [ + "1.1 vegur, 1.1 varnish, 1.1 varnish" + ], + "X-Timer": [ + "S1716214301.157150,VS0,VE348" + ] + }, + "body": { + "string": "{\"data\":{\"name\":\"Example Tag\",\"slug\":\"example-tag\",\"recent_posts\":[{\"created\":\"2024-05-17T14:13:46.787544Z\",\"published\":\"2024-05-17T14:13:46.787109Z\",\"url\":null,\"slug\":\"example-post\",\"featured_image\":\"https://cdn.buttercms.com/WUkiXJ6RCqZmjR8xihEL\",\"featured_image_alt\":\"\",\"author\":{\"first_name\":\"SDK\",\"last_name\":\"Tests\",\"email\":\"sdktests@buttercms.com\",\"slug\":\"sdk-tests\",\"bio\":\"\",\"title\":\"\",\"linkedin_url\":\"\",\"facebook_url\":\"\",\"instagram_url\":\"\",\"pinterest_url\":\"\",\"twitter_handle\":\"\",\"profile_image\":\"\"},\"tags\":[{\"name\":\"Example Tag\",\"slug\":\"example-tag\"}],\"categories\":[{\"name\":\"Example Category\",\"slug\":\"example-category\"}],\"title\":\"Example Post\",\"body\":\"Welcome to ButterCMS! This an example blog post written using Butter.
\\nHere's a helpful walkthrough of our Blog Engine solution.
\\n\\n\\n\\n
If you're viewing this post from your website or command line, you've successfully made a request to the Butter API. If you haven't already, make sure you have our development guides pulled up for step-by-step instructions on setting up Butter.
\\nButter's WYSIWYG editor supports standard text formatting including headings, links, quotes, code, text alignment, and more. You can upload, crop, and resize images which are automatically hosted and delivered through a CDN (see below). You can also edit HTML directly when needed.
\\nYes. Butter can be used as a full CMS for managing dynamic content and creating pages across your entire website or app. Check out our development guides for step-by-step tutorials on setting this up.
\\n\",\"summary\":\"This is an example blog post. Pretty neat huh?\",\"updated\":\"2024-05-17T14:13:46.813008Z\",\"deleted\":null,\"seo_title\":\"Example Post SEO Optimized Title\",\"meta_description\":\"This is our example blog posts SEO optimized meta description.\",\"status\":\"published\"}]}}", + "object": { + "data": { + "name": "Example Tag", + "slug": "example-tag", + "recent_posts": [ + { + "created": "2024-05-17T14:13:46.787544Z", + "published": "2024-05-17T14:13:46.787109Z", + "url": null, + "slug": "example-post", + "featured_image": "https://cdn.buttercms.com/WUkiXJ6RCqZmjR8xihEL", + "featured_image_alt": "", + "author": { + "first_name": "SDK", + "last_name": "Tests", + "email": "sdktests@buttercms.com", + "slug": "sdk-tests", + "bio": "", + "title": "", + "linkedin_url": "", + "facebook_url": "", + "instagram_url": "", + "pinterest_url": "", + "twitter_handle": "", + "profile_image": "" + }, + "tags": [ + { + "name": "Example Tag", + "slug": "example-tag" + } + ], + "categories": [ + { + "name": "Example Category", + "slug": "example-category" + } + ], + "title": "Example Post", + "body": "Welcome to ButterCMS! This an example blog post written using Butter.
\nHere's a helpful walkthrough of our Blog Engine solution.
\n\n\n\n
If you're viewing this post from your website or command line, you've successfully made a request to the Butter API. If you haven't already, make sure you have our development guides pulled up for step-by-step instructions on setting up Butter.
\nButter's WYSIWYG editor supports standard text formatting including headings, links, quotes, code, text alignment, and more. You can upload, crop, and resize images which are automatically hosted and delivered through a CDN (see below). You can also edit HTML directly when needed.
\nYes. Butter can be used as a full CMS for managing dynamic content and creating pages across your entire website or app. Check out our development guides for step-by-step tutorials on setting this up.
\n", + "summary": "This is an example blog post. Pretty neat huh?", + "updated": "2024-05-17T14:13:46.813008Z", + "deleted": null, + "seo_title": "Example Post SEO Optimized Title", + "meta_description": "This is our example blog posts SEO optimized meta description.", + "status": "published" + } + ] + } + } + } + } + } + ] +}