view test/test_search.txt @ 22:17e3a9b6b4e2 default tip

string not tuple
author Jeff Hammel <k0scist@gmail.com>
date Sun, 02 Jun 2024 15:58:09 -0700
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']