view test/test_search.txt @ 11:1c6dbeb4ddab

py3
author Jeff Hammel <k0scist@gmail.com>
date Tue, 24 Nov 2020 13:07:43 -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']