From ddd7c33e8e488ebfb163cef2ebd2ef6cbc9f6dc0 Mon Sep 17 00:00:00 2001
From: rsiddharth
Date: Wed, 11 May 2016 04:10:07 +0000
Subject: Add `DescTBA` feature for LP Schedule.
From now on `DescTBA` can be given if the description for a session is
not decided yet; `DescTBA` will be filtered out of the generated HTML.
Addresses issue #4.
---
libreplanet-templates/2016/lp-schedule.jinja2 | 26 +++++++++++++++-----------
tests/test_lps_gen.py | 25 +++++++++++++++++++++++++
2 files changed, 40 insertions(+), 11 deletions(-)
diff --git a/libreplanet-templates/2016/lp-schedule.jinja2 b/libreplanet-templates/2016/lp-schedule.jinja2
index 1d7cd92..69099cf 100644
--- a/libreplanet-templates/2016/lp-schedule.jinja2
+++ b/libreplanet-templates/2016/lp-schedule.jinja2
@@ -89,17 +89,21 @@
{{ mk_speakers(session_info['speakers']) }}
{{ mk_room(session_info['room']) }}
-
-
-
- {{ desc(session_info['desc']) }}
-
+ {% if session_info['desc'][0]|lower == 'desctba' %}
+
+ {% else %}
+
+
+
+ {{ desc(session_info['desc']) }}
+
+ {% endif %}
{% endfor %} {# session end #}
{% endmacro %}
diff --git a/tests/test_lps_gen.py b/tests/test_lps_gen.py
index 0a8efff..ed479b7 100644
--- a/tests/test_lps_gen.py
+++ b/tests/test_lps_gen.py
@@ -553,6 +553,10 @@ class TestLPSTBA(object):
if len(s.strip())])
+ def cleanup_desc(self, desc):
+ return desc.replace('\n', '').strip()
+
+
def test_LP_speakers(self):
"""Tests the non-existence of `SpeakerTBA` in gen. HTML.
@@ -589,6 +593,27 @@ class TestLPSTBA(object):
assert_equal(room_block, rooms.pop(0))
+ def test_LP_description(self):
+ """Tests the non-existence of `DescTBA` in gen. HTML.
+ """
+ descriptions = [
+ 'Your workplace can exert a lot of control over how',
+ 'Free software developers and users tend to be most',
+ 'This talk will help you gather information, frame',
+ 'A look back at free software history',
+ 'Academic Institutions and their researchers',
+ 'At CUNY, we have taken steps to change this',
+ 'Being a free software user isn\'t easy,',
+ 'In this session, I\'ll give students tips',
+ ]
+
+ for descs in self.soup.find_all(class_='session-desc'):
+ for desc in descs.strings:
+ desc = self.cleanup_desc(desc)
+ if desc:
+ assert desc.startswith(descriptions.pop(0))
+
+
def teardown(self):
"""Cleans up things after each test in this class.
--
cgit v1.2.3