def _get_good_request(self, content=False, second_bmark=False):
        """Return the basics for a good add bookmark request"""
        session = DBSession()

        # the main bookmark, added second to prove popular will sort correctly
        prms = {
            'url': u'http://google.com',
            'description': u'This is my google desc',
            'extended': u'And some extended notes about it in full form',
            'tags': u'python search',
            'api_key': API_KEY,
            'username': u'admin',
            'inserted_by': u'chrome_ext',
        }

        # if we want to test the readable fulltext side we want to make sure we
        # pass content into the new bookmark
        if content:
            prms['content'] = u"<p>There's some content in here dude</p>"

        # rself.assertEqualparams = urllib.urlencode(prms)
        res = self.testapp.post(
            '/api/v1/admin/bmark?',
            content_type='application/json',
            params=json.dumps(prms),
        )

        if second_bmark:
            prms = {
                'url': u'http://bmark.us',
                'description': u'Bookie',
                'extended': u'Exteded notes',
                'tags': u'bookmarks',
                'api_key': API_KEY,
                'username': u'admin',
                'inserted_by': u'chrome_ext',
            }

            # if we want to test the readable fulltext side we want to make
            # sure we pass content into the new bookmark
            prms['content'] = u"<h1>Second bookmark man</h1>"

            # rself.assertEqualparams = urllib.urlencode(prms)
            res = self.testapp.post(
                '/api/v1/admin/bmark?',
                content_type='application/json',
                params=json.dumps(prms)
            )

        session.flush()
        transaction.commit()
        # Run the celery task for indexing this bookmark.
        tasks.reindex_fulltext_allbookmarks(sync=True)
        return res
Exemple #2
0
    def _get_good_request(self, content=False, second_bmark=False):
        """Return the basics for a good add bookmark request"""
        session = DBSession()

        # the main bookmark, added second to prove popular will sort correctly
        prms = {
            'url': u'http://google.com',
            'description': u'This is my google desc',
            'extended': u'And some extended notes about it in full form',
            'tags': u'python search',
            'api_key': API_KEY,
            'username': '******',
            'inserted_by': 'chrome_ext',
        }

        # if we want to test the readable fulltext side we want to make sure we
        # pass content into the new bookmark
        if content:
            prms['content'] = "<p>There's some content in here dude</p>"

        # req_params = urllib.urlencode(prms)
        res = self.testapp.post(
            '/api/v1/admin/bmark?',
            content_type='application/json',
            params=json.dumps(prms),
        )

        if second_bmark:
            prms = {
                'url': u'http://bmark.us',
                'description': u'Bookie',
                'extended': u'Exteded notes',
                'tags': u'bookmarks',
                'api_key': API_KEY,
                'username': '******',
                'inserted_by': 'chrome_ext',
            }

            # if we want to test the readable fulltext side we want to make
            # sure we pass content into the new bookmark
            prms['content'] = "<h1>Second bookmark man</h1>"

            # req_params = urllib.urlencode(prms)
            res = self.testapp.post('/api/v1/admin/bmark?',
                                    content_type='application/json',
                                    params=json.dumps(prms))

        session.flush()
        transaction.commit()
        # Run the celery task for indexing this bookmark.
        tasks.reindex_fulltext_allbookmarks(sync=True)
        return res
Exemple #3
0
    def _get_good_request(self):
        """Return the basics for a good add bookmark request"""
        session = DBSession()
        prms = {
            'url': u'http://google.com',
            'description': u'This is my google desc',
            'extended': u'And some extended notes about it in full form',
            'tags': u'python search',
            'api_key': API_KEY,
            'content': 'bmark content is the best kind of content man',
        }

        req_params = urllib.urlencode(prms)
        res = self.testapp.post('/api/v1/admin/bmark', params=req_params)
        session.flush()
        transaction.commit()
        tasks.reindex_fulltext_allbookmarks(sync=True)
        return res
Exemple #4
0
    def _get_good_request(self):
        """Return the basics for a good add bookmark request"""
        session = DBSession()
        prms = {
            'url': u'http://google.com',
            'description': u'This is my google desc',
            'extended': u'And some extended notes about it in full form',
            'tags': u'python search',
            'api_key': API_KEY,
            'content': 'bmark content is the best kind of content man',
        }

        req_params = urllib.urlencode(prms)
        res = self.testapp.post('/api/v1/admin/bmark',
                                params=req_params)
        session.flush()
        transaction.commit()
        tasks.reindex_fulltext_allbookmarks(sync=True)
        return res
    def _get_good_request(self, new_tags=None):
        """Return the basics for a good add bookmark request"""
        session = DBSession()
        prms = {
            "url": u"http://google.com",
            "description": u"This is my google desc SEE",
            "extended": u"And some extended notes about it in full form",
            "tags": u"python search",
            "api_key": API_KEY,
        }

        if new_tags:
            prms["tags"] = new_tags

        req_params = urllib.urlencode(prms)
        res = self.testapp.post("/api/v1/admin/bmark", params=req_params)

        session.flush()
        transaction.commit()
        tasks.reindex_fulltext_allbookmarks(sync=True)
        return res