2020-10-12 15:17:43 +02:00
|
|
|
import url2markdown.header as header
|
|
|
|
|
|
|
|
|
2020-10-12 15:19:57 +02:00
|
|
|
def test_undefined_topics(create_article):
|
2020-10-12 15:17:43 +02:00
|
|
|
article = create_article()
|
2020-10-12 22:09:47 +02:00
|
|
|
string_header = header.Header(article, [])
|
|
|
|
result = string_header._build_header_dict()
|
2020-10-12 15:19:57 +02:00
|
|
|
assert result['topics'][0] == 'to_categorise'
|
2020-10-12 15:17:43 +02:00
|
|
|
|
|
|
|
|
2020-10-12 16:04:22 +02:00
|
|
|
def test_dict_to_string(create_article):
|
|
|
|
article = create_article()
|
|
|
|
article.keywords = ['foo', 'bar', 'baz']
|
2020-10-12 22:09:47 +02:00
|
|
|
string_header = header.Header(article, [])
|
|
|
|
string = string_header.build_header()
|
2020-10-12 21:49:03 +02:00
|
|
|
assert string == '- meta:\n - topics: [[foo]] [[bar]] [[baz]]\n - date: [[2020-10-09]]\n - authors: [[Daniel Waldmeier]] [[Kei Zuefall]]\n - url: https://www.20min.ch/story/corona-zahlen-auf-einen-blick-803083076953\n'
|