зеркало из https://github.com/mozilla/airmozilla.git
fixes bug 1089733 - event.html shouldn't rely on event's "location_time" if no location
This commit is contained in:
Родитель
810ead7498
Коммит
ce81a8ef99
|
@ -69,8 +69,10 @@
|
|||
<h2 class="event-date">
|
||||
{{ event.start_time | js_date }}
|
||||
{% if event.is_upcoming() %}
|
||||
—
|
||||
{{ event.location_time.strftime("%I:%M%p") }} in {{ event.location.name }}
|
||||
{% if event.location %}
|
||||
—
|
||||
{{ event.location_time.strftime("%I:%M%p") }} in {{ event.location.name }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</h2>
|
||||
{% endif %}
|
||||
|
|
|
@ -2506,6 +2506,35 @@ class TestPages(DjangoTestCase):
|
|||
upcoming_src_after = img.attrib['src']
|
||||
ok_(upcoming_src_after != upcoming_src)
|
||||
|
||||
def test_view_event_without_location(self):
|
||||
event = Event.objects.get(title='Test event')
|
||||
location = Location.objects.create(
|
||||
name='London',
|
||||
timezone='Europe/London'
|
||||
)
|
||||
event.location = location
|
||||
now = datetime.datetime.utcnow().replace(tzinfo=utc)
|
||||
tomorrow = now + datetime.timedelta(days=1)
|
||||
event.start_time = tomorrow
|
||||
event.save()
|
||||
|
||||
assert event in Event.objects.upcoming()
|
||||
|
||||
url = reverse('main:event', args=(event.slug,))
|
||||
response = self.client.get(url)
|
||||
eq_(response.status_code, 200)
|
||||
ok_('London' in response.content)
|
||||
|
||||
location.delete()
|
||||
# reload
|
||||
event = Event.objects.get(id=event.id)
|
||||
ok_(event.location is None)
|
||||
response = self.client.get(url)
|
||||
eq_(response.status_code, 200)
|
||||
ok_('London' not in response.content)
|
||||
# the start time will be described in UTC
|
||||
ok_(event.start_time.strftime('%H:%M %Z') in response.content)
|
||||
|
||||
|
||||
class TestEventEdit(DjangoTestCase):
|
||||
fixtures = ['airmozilla/manage/tests/main_testdata.json']
|
||||
|
|
Загрузка…
Ссылка в новой задаче