summaryrefslogtreecommitdiffstats
path: root/tests/test_lps_gen.py
diff options
context:
space:
mode:
authorrsiddharth <rsd@gnu.org>2016-05-11 03:09:33 +0000
committerrsiddharth <rsd@gnu.org>2016-05-11 03:09:33 +0000
commitf896e22ac564b84c0e5307c2dd461e82b3dd24f1 (patch)
tree265023cc98cf6210674ee379fc688a3411d7f4a3 /tests/test_lps_gen.py
parentce5118e301a7947f23d37ab352ef7e7db7009524 (diff)
Add `SpeakerTBA` feature for LP Schedule.
From now on `SpeakerTBA` can be given if the speaker for a session is not decided yet; `SpeakerTBA` will be filtered out of the generated HTML. Addresses issue #4.
Diffstat (limited to 'tests/test_lps_gen.py')
-rw-r--r--tests/test_lps_gen.py73
1 files changed, 73 insertions, 0 deletions
diff --git a/tests/test_lps_gen.py b/tests/test_lps_gen.py
index 7a55575..254f384 100644
--- a/tests/test_lps_gen.py
+++ b/tests/test_lps_gen.py
@@ -516,6 +516,79 @@ class TestLPS(object):
os.chdir(self.old_cwd)
+class TestLPSTBA(object):
+ """Class tests TBAs in the LP schedule.
+
+ """
+
+ @classmethod
+ def setup_class(self):
+ """Runs before running any tests in this class.
+
+ """
+ # Change current working directory to the tests directory.
+ self.old_cwd = os.getcwd()
+ os.chdir('tests')
+
+ self.MD_FILE = path.join('files', 'lp-sch-tba.md')
+ self.MD_FILE_CONTENT = read_file(self.MD_FILE)
+
+ self.SCH_TEMPLATE = path.join('..', 'libreplanet-templates/2016',
+ 'lp-schedule.jinja2')
+
+ self.markdown = LPSMarkdown()
+ self.lps_dict = self.markdown(self.MD_FILE_CONTENT)
+
+
+ def setup(self):
+ """Runs before each test in this class.
+
+ """
+ lp_html = RenderHTML(self.lps_dict, self.SCH_TEMPLATE)
+ self.soup = BeautifulSoup(lp_html, 'html.parser')
+
+
+ def cleanup_speaker(self, sp):
+ return ' '.join([s.strip() for s in sp.string.split('\n')
+ if len(s.strip())])
+
+
+ def test_LP_speakers(self):
+ """Tests the non-existence of `SpeakerTBA` in gen. HTML.
+
+ """
+ speakers = [
+ 'Paige Peterson, MaidSoft',
+ 'George Chriss and others, Kat Walsh (moderator)',
+ 'Andrew Seeder, Dudley Street Neighborhood Initiative',
+ 'Marina Zhurakhinskaya, Red Hat',
+ 'Marianne Corvellec, April and Jonathan Le Lous, April',
+ 'Scott Dexter and Evan Misshula, CUNY, and Erin Glass, UCSD',
+ 'Michaela R. Brown',
+ ]
+
+ for sp in self.soup.find_all(class_='program-session-speaker'):
+ sp_block = self.cleanup_speaker(sp)
+ assert_equal(sp_block, speakers.pop(0))
+
+
+ def teardown(self):
+ """Cleans up things after each test in this class.
+
+ """
+ # Remove `speakers.noids` file if it exists.
+ if path.isfile('speakers.noids'):
+ os.remove('speakers.noids')
+
+
+ @classmethod
+ def teardown_class(self):
+ """Cleans up the mess after running all tests in this class.
+ """
+ # Change back to the old cwd
+ os.chdir(self.old_cwd)
+
+
class TestLPSpeakers(object):
"""
Class that tests everything related LP Speakers