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-11-09 12:14:47 +01:00
|
|
|
assert string == '- meta:\n - topics: [[foo]] [[bar]] [[baz]]\n - date: [[2020-11-09]]\n - url: https://www.republik.ch/2020/11/09/kann-die-schweiz-auf-rendite-aus-kriegs-material-verzichten\n'
|