implemented pytests for balloons in a new branch
fixed tests for the message balloons fixed tests, fixed the balloons block fixed whitespace issue in test imports
This commit is contained in:
Родитель
33c4d64f0e
Коммит
9f1ffa8142
|
@ -66,6 +66,22 @@ class TestHome(amo.tests.TestCase):
|
|||
nav = pq(r.content)('#aux-nav')
|
||||
eq_(nav.find('.tools').length, 0)
|
||||
|
||||
@mock.patch.object(settings, 'READ_ONLY', False)
|
||||
def test_balloons_no_readonly(self):
|
||||
response = self.client.get('/en-US/firefox/')
|
||||
doc = pq(response.content)
|
||||
eq_(doc('#site-notice').length, 0)
|
||||
eq_(doc('#site-nonfx').length, 1)
|
||||
eq_(doc('#site-welcome').length, 1)
|
||||
|
||||
@mock.patch.object(settings, 'READ_ONLY', True)
|
||||
def test_balloons_readonly(self):
|
||||
response = self.client.get('/en-US/firefox/')
|
||||
doc = pq(response.content)
|
||||
eq_(doc('#site-notice').length, 1)
|
||||
eq_(doc('#site-nonfx').length, 1)
|
||||
eq_(doc('#site-welcome').length, 1)
|
||||
|
||||
def test_tools_regular_user(self):
|
||||
self.client.login(username='regular@mozilla.com', password='password')
|
||||
r = self.client.get(reverse('home'), follow=True)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
{% block aux_nav %}{% endblock %}
|
||||
|
||||
{% block balloons %}{% endblock %}
|
||||
{% block amo_balloons %}{% endblock %}
|
||||
|
||||
{% block footer %}
|
||||
{% include "amo_footer_small.html" %}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
from django.conf import settings
|
||||
|
||||
from nose.tools import eq_
|
||||
from pyquery import PyQuery as pq
|
||||
|
||||
from mock import patch
|
||||
from amo.helpers import absolutify, page_title
|
||||
import amo.tests
|
||||
from amo.urlresolvers import reverse
|
||||
|
@ -48,6 +50,22 @@ class TestListing(WebappTest):
|
|||
self.url + '?sort=downloads')
|
||||
eq_(doc('#featured-apps a').attr('href'), self.url + '?sort=featured')
|
||||
eq_(doc('#submit-app a').attr('href'), reverse('devhub.submit_apps.1'))
|
||||
|
||||
@patch.object(settings, 'READ_ONLY', False)
|
||||
def test_balloons_no_readonly(self):
|
||||
response = self.client.get(self.url)
|
||||
doc = pq(response.content)
|
||||
eq_(doc('#site-notice').length, 0)
|
||||
eq_(doc('#site-nonfx').length, 0)
|
||||
eq_(doc('#site-welcome').length, 0)
|
||||
|
||||
@patch.object(settings, 'READ_ONLY', True)
|
||||
def test_balloons_readonly(self):
|
||||
response = self.client.get(self.url)
|
||||
doc = pq(response.content)
|
||||
eq_(doc('#site-notice').length, 1)
|
||||
eq_(doc('#site-nonfx').length, 0)
|
||||
eq_(doc('#site-welcome').length, 0)
|
||||
|
||||
def test_footer(self):
|
||||
response = self.client.get(self.url)
|
||||
|
|
|
@ -87,7 +87,6 @@
|
|||
{{ site_nav() }}
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% block balloons %}
|
||||
{% if ADMIN_MESSAGE or settings.READ_ONLY %}
|
||||
<div class="site-balloon" id="site-notice">
|
||||
{% if ADMIN_MESSAGE %}
|
||||
|
@ -101,6 +100,7 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% block amo_balloons %}
|
||||
<div class="site-balloon" id="site-nonfx">
|
||||
<p>
|
||||
{% trans url='http://mozilla.org/firefox/?src=amo' %}
|
||||
|
|
Загрузка…
Ссылка в новой задаче