-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…157)
- Loading branch information
1 parent
66d302e
commit bdd2178
Showing
4 changed files
with
72 additions
and
2 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
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
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Note - most tests for the `change_password` endpoint are in `test_session.py` | ||
|
||
from unittest import TestCase | ||
|
||
from starlette.routing import Route, Router | ||
from starlette.testclient import TestClient | ||
|
||
from piccolo_api.change_password.endpoints import change_password | ||
|
||
|
||
class TestChangePassword(TestCase): | ||
def test_change_password(self): | ||
app = Router(routes=[Route("/", change_password(read_only=True))]) | ||
client = TestClient(app) | ||
response = client.post("/") | ||
self.assertTrue(response.status_code, 405) | ||
self.assertTrue(response.content, "Running in read only mode.") |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Note - most tests for the `register` endpoint are in `test_session.py` | ||
|
||
from unittest import TestCase | ||
|
||
from starlette.routing import Route, Router | ||
from starlette.testclient import TestClient | ||
|
||
from piccolo_api.register.endpoints import register | ||
|
||
|
||
class TestRegister(TestCase): | ||
def test_read_only(self): | ||
app = Router(routes=[Route("/", register(read_only=True))]) | ||
client = TestClient(app) | ||
response = client.post("/") | ||
self.assertTrue(response.status_code, 405) | ||
self.assertTrue(response.content, "Running in read only mode.") |