Beispiel #1
0
    def test_get_existing(self):
        from collective.bookmarks.storage import Bookmarks

        import uuid

        bookmarks = Bookmarks()
        data = {
            "owner": "kim stanley",
            "uid": uuid.uuid4(),
            "group": "",
            "payload": {}
        }
        bookmarks.add(data["owner"], data["uid"], data["group"],
                      data["payload"])
        result = bookmarks.get(data["owner"], data["uid"], data["group"])
        result["created"] = None
        self.assertEqual(
            result,
            {
                "created": None,
                "group": "",
                "owner": "kim stanley",
                "payload": {},
                "uid": data["uid"],
            },
        )
Beispiel #2
0
    def reply(self):
        """get bookmark by

        uid
        owner
        group
        queryparams (optional): serialized querystring
        """
        owner, uid, group, queryparams, payload = get_bookmark_from_request(
            self.request)
        bookmarks = Bookmarks()
        bookmark = bookmarks.get(owner, uid, group, queryparams)
        if bookmark:
            return bookmark_dict_to_json_dict(bookmark)
        raise NotFound("No such bookmark found.")