-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 #8562 from cdrini/refactor/dissolve-list-mixin
Refactor: Dissolve ListMixin
- Loading branch information
Showing
9 changed files
with
151 additions
and
155 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from openlibrary.mocks.mock_infobase import MockSite | ||
import openlibrary.core.lists.model as list_model | ||
|
||
|
||
class TestList: | ||
def test_owner(self): | ||
list_model.register_models() | ||
self._test_list_owner("/people/anand") | ||
self._test_list_owner("/people/anand-test") | ||
self._test_list_owner("/people/anand_test") | ||
|
||
def _test_list_owner(self, user_key): | ||
site = MockSite() | ||
list_key = user_key + "/lists/OL1L" | ||
|
||
self.save_doc(site, "/type/user", user_key) | ||
self.save_doc(site, "/type/list", list_key) | ||
|
||
list = site.get(list_key) | ||
assert list is not None | ||
assert isinstance(list, list_model.List) | ||
|
||
assert list.get_owner() is not None | ||
assert list.get_owner().key == user_key | ||
|
||
def save_doc(self, site, type, key, **fields): | ||
d = {"key": key, "type": {"key": type}} | ||
d.update(fields) | ||
site.save(d) |
Oops, something went wrong.