Skip to content

Commit

Permalink
Facets docs are ready, I think!
Browse files Browse the repository at this point in the history
  • Loading branch information
nedtwigg committed Dec 16, 2024
1 parent 1bc93db commit f7dc819
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions selfie.dev/src/pages/py/facets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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("""
<html><body>
<h1>Please login</h1>
Expand All @@ -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("""
<html><body>
<h1>Please login</h1>
Expand All @@ -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("""
<html><body>
<h1>Please login</h1>
Expand Down Expand Up @@ -243,7 +243,7 @@ [email protected]|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.

Expand Down

0 comments on commit f7dc819

Please sign in to comment.