linkedin and github link (#27)

* Ref #24 linkedin and github social link in author page and article page

-test case for that

- BaseTest added

* Ref #24 icon to link since linkedin and github is not present

* article color fix
This commit is contained in:
Arul 2018-05-18 17:26:41 +05:30 committed by GitHub
parent 7b26ad1013
commit 1e0a56e0d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 225 additions and 181 deletions

44
tests/test_author_bio.py Normal file
View file

@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import locale
from shutil import copy, rmtree
from support import (get_my_settings, unittest, BaseTest, CUR_DIR, CONTENT_DIR, OUTPUT_DIR)
def tearDownModule():
print("teardown module")
try:
rmtree(OUTPUT_DIR)
except OSError, e:
print ("Error: %s - %s." % (e.filename,e.strerror))
class AuthorSocialLinksTest(unittest.TestCase, BaseTest):
def setUp(self):
self.initSettings()
def tearDown(self):
locale.setlocale(locale.LC_ALL, self.old_locale)
def test_linkedin_link(self):
authorName = "raj"
self.settings['AUTHORS_BIO'] = {
authorName: {
'cover': "http://examble.com/cover.jpg",
'linkedin': "mylinkedinname"
}
}
rstPath="content/article_with_og_image.rst"
result, soup = self.gen_article_and_html_from_rst(rstPath)
selected = soup.find(name="span", attrs={"class": "post-author-linkedin"})
# Assertion
self.assertTrue("https://www.linkedin.com/in/mylinkedinname" in str(selected))
result, soup = self.gen_author_and_html_from_name(authorName)
selected = soup.find(name="span", attrs={"class": "post-author-linkedin"})
# Assertion
self.assertTrue("https://www.linkedin.com/in/mylinkedinname" in str(selected))
if __name__ == '__main__':
unittest.main()