-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 support/fixed signal when using @transaction because of session.beg…
…in_nested
- Loading branch information
legolas.zhan
committed
May 18, 2022
1 parent
65e60b5
commit ccfda8f
Showing
7 changed files
with
77 additions
and
3 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
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
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 |
---|---|---|
|
@@ -301,3 +301,22 @@ def test_autocommittrue_not_excepted(self, auto_session, assert_session): | |
|
||
# assert not rollback. Be very careful when using commit. 😒😒😒😒 | ||
assert len(assert_session.query(User).all()) == 1 | ||
|
||
|
||
class TestNestedSessionSignal(BaseTest): | ||
|
||
def test_transaction_signal_success(self, client, assert_session): | ||
email = "[email protected]" | ||
resp = client.post('/create_user/success/', json={"email": email}) | ||
assert resp.status_code == 200 | ||
|
||
user = assert_session.query(User).filter(User.email == email).first() | ||
assert user and user.username == "signalling_ok" | ||
|
||
def test_transaction_signal_dailed(self, client, assert_session): | ||
email = "[email protected]" | ||
resp = client.post('/create_user/failed/', json={"email": email}) | ||
assert resp.status_code == 200 | ||
|
||
user = assert_session.query(User).filter(User.email == email).first() | ||
assert user and user.username != "signalling_ok" |