From eea48c87dce0bf1559cf77a7b9aaa8f515e9cc13 Mon Sep 17 00:00:00 2001 From: Jeff Balogh Date: Mon, 27 Dec 2010 13:51:07 -0500 Subject: [PATCH] tests for performance_note (bug 620093) --- apps/addons/tests/test_helpers.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/apps/addons/tests/test_helpers.py b/apps/addons/tests/test_helpers.py index 07a2594bd7..ba6ab030df 100644 --- a/apps/addons/tests/test_helpers.py +++ b/apps/addons/tests/test_helpers.py @@ -4,7 +4,8 @@ from nose.tools import eq_ from pyquery import PyQuery import amo -from addons.helpers import statusflags, flag, support_addon, contribution +from addons.helpers import (statusflags, flag, support_addon, contribution, + performance_note) from addons.models import Addon @@ -69,3 +70,26 @@ class TestHelpers(test_utils.TestCase): # make sure input boxes are rendered correctly (bug 555867) assert doc('input[name=onetime-amount]').length == 1 assert doc('input[name=monthly-amount]').length == 1 + + +class TestPerformanceNote(test_utils.TestCase): + listing = '
' + not_listing = '
' + + def setUp(self): + request_mock = Mock() + request_mock.APP = amo.FIREFOX + self.ctx = {'request': request_mock, 'amo': amo} + + def test_show_listing(self): + r = performance_note(self.ctx, 30, listing=True) + assert self.listing in r, r + + def test_show_not_listing(self): + r = performance_note(self.ctx, 30) + assert self.not_listing in r, r + + def test_only_fx(self): + self.ctx['request'].APP = amo.THUNDERBIRD + r = performance_note(self.ctx, 30) + eq_(r.strip(), '')