Example #1
0
 def _raw_update_history_item(self, history_id, item_id, data):
     update_url = self._api_url("histories/%s/contents/%s" %
                                (history_id, item_id),
                                use_key=True)
     update_response = put(update_url, json=data)
     assert_status_code_is_ok(update_response)
     return update_response
Example #2
0
    def test_page_encoding(self):
        history_id = self.dataset_populator.new_history()
        request = dict(
            slug="mypage",
            title="MY PAGE",
            content=
            '''<p>Page!<div class="embedded-item" id="History-%s"></div></p>'''
            % history_id,
        )
        page_response = self._post("pages", request)
        api_asserts.assert_status_code_is_ok(page_response)
        sa_session = self._app.model.context
        page_revision = sa_session.query(model.PageRevision).all()[0]
        assert '''id="History-1"''' in page_revision.content, page_revision.content
        assert '''id="History-%s"''' % history_id not in page_revision.content, page_revision.content

        show_page_response = self._get("pages/%s" % page_response.json()["id"])
        api_asserts.assert_status_code_is_ok(show_page_response)
        content = show_page_response.json()["content"]
        assert '''id="History-1"''' not in content, content
        assert '''id="History-%s"''' % history_id in content, content
Example #3
0
 def _get_history_item_as_admin(self, history_id, item_id):
     response = self._get("histories/%s/contents/%s?view=detailed" %
                          (history_id, item_id),
                          admin=True)
     assert_status_code_is_ok(response)
     return response.json()
Example #4
0
 def _get_history_item_as_admin(self, history_id, item_id):
     response = self._get("histories/%s/contents/%s?view=detailed" % (history_id, item_id), admin=True)
     assert_status_code_is_ok(response)
     return response.json()
Example #5
0
 def _raw_update_history_item(self, history_id, item_id, data):
     update_url = self._api_url("histories/%s/contents/%s" % (history_id, item_id), use_key=True)
     update_response = put(update_url, json=data)
     assert_status_code_is_ok(update_response)
     return update_response