-
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.
Clean up auto-noncing in integ tests #52
- Loading branch information
1 parent
ba23122
commit 5c39df0
Showing
2 changed files
with
41 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,32 @@ | ||
"""Basic scenarios, symmetric tests""" | ||
from bloop import new_base, Column, Integer | ||
import pytest | ||
from bloop import String | ||
from bloop import new_base, Column, Integer, NotModified | ||
|
||
|
||
def test_crud(engine): | ||
class User(new_base()): | ||
id = Column(Integer, hash_key=True) | ||
class User(new_base()): | ||
id = Column(Integer, hash_key=True) | ||
name = Column(String) | ||
|
||
|
||
def test_crud(engine): | ||
engine.bind(User) | ||
|
||
user = User(id=0, name="first") | ||
engine.save(user) | ||
|
||
same_user = User(id=user.id) | ||
engine.load(same_user) | ||
assert user.name == same_user.name | ||
|
||
same_user.name = "second" | ||
engine.save(same_user) | ||
|
||
engine.load(user) | ||
assert user.name == same_user.name | ||
|
||
engine.delete(user) | ||
|
||
with pytest.raises(NotModified) as excinfo: | ||
engine.load(same_user) | ||
assert same_user in excinfo.value.objects |