~jcsackett/charmworld/bac-tag-constraints

« back to all changes in this revision

Viewing changes to charmworld/testing/__init__.py

  • Committer: Aaron Bentley
  • Date: 2013-03-28 16:55:07 UTC
  • mto: This revision was merged to the branch mainline in revision 182.
  • Revision ID: aaron@canonical.com-20130328165507-yoiwb2pdby5tz9n8
Remove all mention of Xapian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
from charmworld.models import getconnection
18
18
from charmworld.models import getdb
19
19
from charmworld.models import getfs
 
20
from charmworld.search import ElasticSearchClient
20
21
from charmworld.testing.factory import makeSSOResponse
21
22
from charmworld.utils import get_ini
22
23
 
160
161
    if not len(args):
161
162
        args = ["Exception forced by mock."]
162
163
    return mock.Mock(side_effect=exception_type(*args))
 
164
 
 
165
 
 
166
@contextmanager
 
167
def temp_index_client():
 
168
    client = ElasticSearchClient.from_settings(INI, 'temp_index')
 
169
    try:
 
170
        yield client
 
171
    finally:
 
172
        client.delete_index()