view test/test_search.txt @ 17:cabe97535057

py3
author Jeff Hammel <k0scist@gmail.com>
date Tue, 24 Nov 2020 13:15:33 -0800
parents b0942f44413f
children
line wrap: on
line source

Test toolbox search
===================

Ensure toolbox search does what we want it to.  First, create some
projects::

    >>> app.get('/')
    []
    >>> project = {'name': 'bzconsole', 'description': 'interact with bugzilla from the command line', 'url': 'http://k0s.org/mozilla/hg/bzconsole'}
    >>> response = app.new(**project)
    >>> project = {'name': 'my crazy addon', 'description': 'a crazy addon i made', 'url': 'http://a.m.o'}
    >>> response = app.new(**project)
    >>> [i['name'] for i in app.get('/')]
    [u'my crazy addon', u'bzconsole']

Define a search interface for our convenience::

    >>> def search(query):
    ...     return [i['name'] for i in app.get('/', params=dict(q=query))]
    >>> search('addon')
    [u'my crazy addon']

You should be able to search for a name::

    >>> search('bzconsole')
    [u'bzconsole']