コード例 #1
0
ファイル: test_base.py プロジェクト: secretrobotron/bedrock
from bedrock.base.urlresolvers import reverse
from mock import patch, Mock
from nose.tools import eq_
from pathlib import Path
from pyquery import PyQuery as pq
from rna.models import Release

from bedrock.firefox.firefox_details import FirefoxDesktop
from bedrock.mozorg.tests import TestCase
from bedrock.releasenotes import views
from bedrock.thunderbird.details import ThunderbirdDesktop

DATA_PATH = str(Path(__file__).parent / 'data')
firefox_desktop = FirefoxDesktop(json_dir=DATA_PATH)
thunderbird_desktop = ThunderbirdDesktop(json_dir=DATA_PATH)


class TestRNAViews(TestCase):
    def setUp(self):
        self.factory = RequestFactory()
        self.request = self.factory.get('/')

        self.render_patch = patch(
            'bedrock.releasenotes.views.l10n_utils.render')
        self.mock_render = self.render_patch.start()
        self.mock_render.return_value.has_header.return_value = False

    def tearDown(self):
        self.render_patch.stop()
コード例 #2
0
from bedrock.base.urlresolvers import reverse
from mock import patch
from nose.tools import eq_, ok_
from pyquery import PyQuery as pq

from bedrock.thunderbird import views as tb_views
from bedrock.thunderbird.details import ThunderbirdDesktop
from bedrock.mozorg.tests import TestCase


TEST_DATA_DIR = os.path.join(settings.ROOT, 'bedrock', 'firefox', 'tests', 'test_data')
PROD_DETAILS_DIR = os.path.join(TEST_DATA_DIR, 'product_details_json')
GOOD_PLATS = {'Windows': {}, 'OS X': {}, 'Linux': {}}

thunderbird_desktop = ThunderbirdDesktop(json_dir=PROD_DETAILS_DIR)


@patch.object(tb_views, 'thunderbird_desktop', thunderbird_desktop)
class TestThunderbirdAll(TestCase):
    def _get_url(self, channel='release'):
        with self.activate('en-US'):
            kwargs = {}

            if channel != 'release':
                kwargs['channel'] = channel

            return reverse('thunderbird.latest.all', kwargs=kwargs)

    def test_no_search_results(self):
        """