~jcsackett/charmworld/bac-tag-constraints

« back to all changes in this revision

Viewing changes to charmworld/tests/test_health.py

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

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
    check_elasticsearch,
9
9
    check_mongodb,
10
10
)
11
 
from charmworld.models import FeaturedSource
12
11
from charmworld.testing import (
13
12
    factory,
14
13
    ViewTestBase,
50
49
        self.assertCheck(check, 'charms collection', 'Fail')
51
50
 
52
51
    def test_check_elasticsearch_pass(self):
53
 
        charm_data = factory.makeCharm(self.db)[1]
 
52
        ignore, charm_data = factory.makeCharm(self.db)
54
53
        self.use_index_client()
55
54
        self.index_client.index_charm(charm_data)
56
55
        check = check_elasticsearch(self.getRequest())
71
70
        self.assertCheck(check, 'charms index', 'Fail')
72
71
 
73
72
    def test_check_api_pass(self):
74
 
        charm_data = factory.makeCharm(self.db, downloads=5)[1]
 
73
        ignore, charm_data = factory.makeCharm(
 
74
            self.db, downloads=5, is_featured=True)
75
75
        self.use_index_client()
76
76
        self.index_client.index_charm(charm_data)
77
 
        FeaturedSource.from_db(self.db).set_featured(charm_data, 'charm')
78
77
        check = check_api(self.getRequest())
79
78
        remark = 'Interesting has new, popular, and featured.'
80
79
        self.assertCheck(check, 'API interesting', 'Pass', remark)
81
80
 
82
81
    def test_check_api_missing_data_fail(self):
83
 
        charm_data = factory.makeCharm(self.db)[1]
 
82
        ignore, charm_data = factory.makeCharm(self.db)
84
83
        self.use_index_client()
85
84
        self.index_client.index_charm(charm_data)
86
85
        # There are no featured or downloaded charms.