def test_published_applications_are_listed(self): app = fixtures.get_application( name='Gigabit app', status=Application.PUBLISHED) response = views.app_list(self.factory.get('/app/')) eq_(response.status_code, 200) eq_(list(response.context_data['page'].object_list), [app]) _teardown_apps()
def test_non_published_applications_are_not_shown(self): fixtures.get_application( name='Gigabit app', status=Application.DRAFT) response = views.app_list(self.factory.get('/app/')) eq_(response.status_code, 200) eq_(len(response.context_data['page'].object_list), 0) _teardown_apps()
def test_applications_are_reverse_sorted(self): owner = get_user('us-ignite') app_a = fixtures.get_application( name='alpha app', status=Application.PUBLISHED, owner=owner) app_b = fixtures.get_application( name='beta app', status=Application.PUBLISHED, owner=owner) response = views.app_list(self.factory.get('/app/', {'order': '-name'})) eq_(list(response.context_data['page'].object_list), [app_b, app_a]) _teardown_apps()
def test_applications_are_listed_by_domain(self): domain = fixtures.get_domain(name='foo') owner = get_user('us-ignite') app_a = fixtures.get_application( name='alpha app', status=Application.PUBLISHED, owner=owner, domain=domain) fixtures.get_application( name='beta app', status=Application.PUBLISHED, owner=owner) response = views.app_list(self.factory.get('/app/foo/'), 'foo') eq_(response.status_code, 200) eq_(response.template_name, 'apps/object_list.html') eq_(list(response.context_data['page'].object_list), [app_a]) _teardown_apps()
def test_application_context_is_valid(self): response = views.app_list(self.factory.get('/app/')) eq_(sorted(response.context_data.keys()), ['domain_list', 'order', 'order_form', 'page'])
def test_application_context_is_valid(self): response = views.app_list(self.factory.get('/app/')) eq_(sorted(response.context_data.keys()), sorted(['current_domain', 'current_stage', 'domain_list', 'featured_list', 'filter_name', 'order', 'order_form', 'page', 'stage_list']))