From f7dc8194a2386b47528550cc76faf77cb451c31d Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Sun, 15 Dec 2024 23:43:19 -0800 Subject: [PATCH] Facets docs are ready, I think! --- selfie.dev/src/pages/py/facets.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/selfie.dev/src/pages/py/facets.mdx b/selfie.dev/src/pages/py/facets.mdx index 682021a0..344939b4 100644 --- a/selfie.dev/src/pages/py/facets.mdx +++ b/selfie.dev/src/pages/py/facets.mdx @@ -28,7 +28,7 @@ def client(): with app.test_client() as client: yield client -def test_homepage(client): +def test_homepage_v1(client): expect_selfie(client.get("/").data.decode()).to_be("""

Please login

@@ -52,7 +52,7 @@ from werkzeug.test import TestResponse # this is what `app.test_client().get` re def web_selfie(response: TestResponse) -> StringSelfie: return expect_selfie(response.data.decode()) -def test_homepage(client): +def test_homepage_v2(client): web_selfie(client.get("/")).to_be("""

Please login

@@ -79,7 +79,7 @@ def web_selfie(response: TestResponse) -> StringSelfie: And now our snapshot has `status` at the bottom, which we can use in both literal and disk snapshots. ```python -def test_homepage(): +def test_homepage_v2(): expect_selfie(get("/")).toBe("""

Please login

@@ -243,7 +243,7 @@ login=user@domain.com|JclThw==;Path=/""") status code: 401""") ``` -We just wrote a high-level specification of a realistic login flow, and it only took TODO lines of python code — most of which were generated for us, and could be regenerated on a whim if we want to change our copywriting. The [corresponding disk snapshot TODO](https://github.com/diffplug/selfie/issues/322) gives us an exhaustive specification and description of the server's behavior. +We just wrote a high-level specification of a realistic login flow, and it only took 24 lines of python code — most of which were generated for us, and could be regenerated on a whim if we want to change our copywriting. The [corresponding disk snapshot](https://github.com/diffplug/selfie/blob/main/python/example-pytest-selfie/tests/app_account_test.ss) gives us an exhaustive specification and description of the server's behavior. Didn't think that adopting a bugfixed version of your internationalization lib would cause any changes to your website whatsever? Oops. Don't wade through failed assertions, get a diff in every failure. If you want, regenerate all the snapshots to get a full view of the problem across the whole codebase in your git client.