~jcsackett/charmworld/bac-tag-constraints

« back to all changes in this revision

Viewing changes to charmworld/views/tests/test_api.py

[r=sinzui][bug=1208477][author=abentley] Remove doctype attribute.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from charmworld.models import (
22
22
    Charm,
23
23
    CharmSource,
24
 
    FeaturedSource,
25
24
    QADataSource,
26
25
)
27
26
from charmworld.views.api import (
29
28
    json_response,
30
29
)
31
30
from charmworld.search import (
32
 
    charm_exact_fields,
33
 
    charm_free_text_fields,
 
31
    exact_fields,
 
32
    free_text_fields,
34
33
)
35
34
from charmworld.testing import factory
36
35
from charmworld.testing import (
134
133
        self.use_index_client()
135
134
 
136
135
    def makeCharm(self, *args, **kwargs):
137
 
        is_featured = kwargs.pop('is_featured', False)
138
136
        charm_id, charm = factory.makeCharm(self.db, *args, **kwargs)
139
137
        self.index_client.index_charm(charm)
140
 
        if is_featured:
141
 
            FeaturedSource.from_db(self.db).set_featured(charm, 'charm')
142
138
        return charm_id, charm
143
139
 
144
140
    def test_remote_friendly_headers(self):
418
414
        matching_charm = Charm(self.makeCharm(name='foo')[1])
419
415
        matching_id = self.api_class._get_api_id(matching_charm)
420
416
        differing_charm = self.makeCharm(name='bar')[1]
421
 
        for field in charm_free_text_fields:
 
417
        for field in free_text_fields:
422
418
            if '.' in field or field == 'name':
423
419
                continue
424
420
            differing_charm[field] = 'foo'
425
 
        for field in charm_exact_fields:
 
421
        for field in exact_fields:
426
422
            differing_charm[field] = 'foo'
427
423
        self.index_client.index_charm(differing_charm)
428
424
        response = self.get_response(