-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from fizyk/squash_compose
Squash most of the compose sections to the defaults
- Loading branch information
Showing
10 changed files
with
68 additions
and
80 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
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,35 @@ | ||
from mock import Mock, patch | ||
|
||
from pyramid_basemodel.mixin import TouchMixin | ||
|
||
|
||
def test_touch_mixin(): | ||
"""Check wether every argument of TouchMixin get's called in proper order.""" | ||
t = TouchMixin() | ||
saved_arg = [] | ||
|
||
def save_mock(instance): | ||
saved_arg.append(instance) | ||
|
||
assert not hasattr(t, "modified") | ||
with patch.object(t, "propagate_touch") as propagate_mock: | ||
t.touch(now=Mock, save=save_mock) | ||
assert propagate_mock.called | ||
assert hasattr(t, "modified") | ||
assert t == saved_arg[0] | ||
|
||
|
||
def test_touch_mixin_no_propagate(): | ||
"""Check wether every argument of TouchMixin get's called in proper order.""" | ||
t = TouchMixin() | ||
saved_arg = [] | ||
|
||
def save_mock(instance): | ||
saved_arg.append(instance) | ||
|
||
assert not hasattr(t, "modified") | ||
with patch.object(t, "propagate_touch") as propagate_mock: | ||
t.touch(False, now=Mock, save=save_mock) | ||
assert not propagate_mock.called | ||
assert hasattr(t, "modified") | ||
assert t == saved_arg[0] |