From fa7dec289c0b5b2ab7b447f0c64ec2be0c5e93b9 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sun, 7 Feb 2016 14:12:33 -0500 Subject: Added template (under tests) for LP speakers' page Address issue #1. --- tests/files/lp-speakers-2016.jinja2 | 124 ++++++++++++++++++++++++++++++++++++ tests/test_lps_gen.py | 10 +++ 2 files changed, 134 insertions(+) create mode 100644 tests/files/lp-speakers-2016.jinja2 (limited to 'tests') diff --git a/tests/files/lp-speakers-2016.jinja2 b/tests/files/lp-speakers-2016.jinja2 new file mode 100644 index 0000000..5c1c132 --- /dev/null +++ b/tests/files/lp-speakers-2016.jinja2 @@ -0,0 +1,124 @@ +{# -*- mode: jinja2; -*- #} +{# + Copyright (C) 2016 lpschedule-generator contributors. See CONTRIBUTORS. + + This file is part of lpschedule-generator. + + lpschedule-generator is free software: you can redistribute it + and/or modify it under the terms of the GNU General Public License + as published by the Free Software Foundation, either version 3 of + the License, or (at your option) any later version. + + lpschedule-generator is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with lpschedule-generator (see COPYING). If not, see + . +#} + + +{# make speakers header macro #} +{% macro mk_speakers_header(speaker_type) %} +
+
+ {% if speaker_type == 'keynote-speakers' %} +

Keynote speakers

+ {% else %} +

Speakers

+ {% endif %} +
+
+{% endmacro %} + +{# make keynote speaker header macro #} +{% macro mk_keynote_speaker_header(speaker, id) %} +
+
+

{{ speaker }}

+
+
+{% endmacro %} + +{# make speaker header macro #} +{% macro mk_speaker_header(speaker, id) %} +
+
+

{{ speaker }}

+
+
+{% endmacro %} + +{# make bio macro #} +{% macro mk_bio(bio_list) %} + {% for bio_p in bio_list %} +

{{ bio_p }}

+ {% endfor %} +{% endmacro %} + +{# populate keynote speakers macro #} +{% macro populate_keynote_speakers(speakers) %} + {% for speaker in speakers %} +
+ +
+ {% if speaker.img_url %} + +
+ [ {{ speaker.img_alt }} ] +
+ +
+ {% else %} + +
+ {% endif %} + {{ mk_keynote_speaker_header(speaker.speaker, speaker.id) }} + {{ mk_bio(speaker.bio) }} +
+
+
+ {% endfor %} +{% endmacro %} + +{# populate speakers macro #} +{% macro populate_speakers(speakers) %} + {% for speaker in speakers %} +
+
+ {% if speaker.img_url %} + +
+ [ {{ speaker.img_alt }} ] +
+ +
+ {% else %} + +
+ {% endif %} + {{ mk_speaker_header(speaker.speaker, speaker.id) }} + {{ mk_bio(speaker.bio) }} +
+
+
+ {% endfor %} +{% endmacro %} + +{# lp speakers 2016 template start #} +{% for speaker_type, speakers in lp_dict.iteritems() %} +
+ {% if speaker_type == 'keynote-speakers' %} + {{ mk_speakers_header(speaker_type) }} + {{ populate_keynote_speakers(speakers) }} + {% elif speaker_type == 'speakers' %} + {{ mk_speakers_header(speaker_type) }} + {{ populate_speakers(speakers) }} + {% endif %} +
+{% endfor %} +{# lp speakers 2016 template end #} diff --git a/tests/test_lps_gen.py b/tests/test_lps_gen.py index c2c94e4..ad66aa9 100644 --- a/tests/test_lps_gen.py +++ b/tests/test_lps_gen.py @@ -212,6 +212,9 @@ class TestLPSpeakers(object): self.MD_FILE = path.join('tests', 'files', 'lp-speakers.md') self.MD_FILE_CONTENT = read_file(self.MD_FILE) + self.SPEAKERS_TEMPLATE = path.join('tests', 'files', + 'lp-speakers-2016.jinja2') + self.markdown = LPSpeakersMarkdown() self.lpspeakers_dict = self.markdown(self.MD_FILE_CONTENT) @@ -431,6 +434,13 @@ class TestLPSpeakers(object): i = i + 1 + def test_RenderHTML(self): + """Testing `RenderHTML` function with LP speakers + """ + lps_html = RenderHTML(self.lpspeakers_dict, self.SPEAKERS_TEMPLATE) + print lps_html + + def teardown(self): """Cleans up things after each test in this class.""" pass -- cgit v1.2.3