-
Notifications
You must be signed in to change notification settings - Fork 27
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
1 parent
a8c213e
commit cb6966f
Showing
1 changed file
with
50 additions
and
0 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 |
---|---|---|
|
@@ -1129,6 +1129,56 @@ def test_match(self): | |
) | ||
|
||
|
||
class TestFilterEmail(TestCase): | ||
""" | ||
Make suer that ``Email`` columns can be filtered - i.e. we can pass in | ||
partial emails like ``google.com``. | ||
""" | ||
|
||
def setUp(self): | ||
Studio.create_table(if_not_exists=True).run_sync() | ||
|
||
def tearDown(self): | ||
Studio.alter().drop_table().run_sync() | ||
|
||
def test_filter_email(self): | ||
client = TestClient(PiccoloCRUD(table=Studio)) | ||
|
||
Studio.insert( | ||
Studio( | ||
{ | ||
Studio.name: "Studio 1", | ||
Studio.booking_email: "[email protected]", | ||
Studio.contact_email: "[email protected]", | ||
} | ||
), | ||
Studio( | ||
{ | ||
Studio.name: "Studio 2", | ||
Studio.booking_email: "[email protected]", | ||
Studio.contact_email: "[email protected]", | ||
} | ||
), | ||
).run_sync() | ||
|
||
response = client.get("/?booking_email=booking_1") | ||
self.assertEqual(response.status_code, 200) | ||
|
||
self.assertEqual( | ||
response.json(), | ||
{ | ||
"rows": [ | ||
{ | ||
"booking_email": "[email protected]", | ||
"contact_email": "[email protected]", | ||
"id": 1, | ||
"name": "Studio 1", | ||
} | ||
] | ||
}, | ||
) | ||
|
||
|
||
class TestExcludeSecrets(TestCase): | ||
""" | ||
Make sure that if ``exclude_secrets`` is ``True``, then values for | ||
|