-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
4 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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> | ||
|
@@ -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> | ||
|
@@ -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> | ||
|
@@ -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. | ||
|
||
|