ソースを参照

Add test for different article, doesn't run

JoostSijm 4 年 前
コミット
e38301ed77
1 ファイル変更21 行追加1 行削除
  1. 21 1
      tests/test_vboo_info_bot_functions.py

+ 21 - 1
tests/test_vboo_info_bot_functions.py

@@ -14,7 +14,7 @@ def article_keys():
         'language']
 
 @pytest.mark.vcr()
-def test_article_info(api_wrapper, article_keys):
+def test_article_info_one(api_wrapper, article_keys):
     """Test article info"""
     article_id = 2708696
     response = Article(api_wrapper).info(article_id)
@@ -32,3 +32,23 @@ def test_article_info(api_wrapper, article_keys):
     assert isinstance(response['content_text'], str), "Content text should be a string"
     assert isinstance(response['content_html'], str), "Content html should be a string"
     assert isinstance(response['language'], str), "Language should be a string"
+
+@pytest.mark.vcr()
+def test_article_info_two(api_wrapper, article_keys):
+    """Test article info"""
+    article_id = 2862982
+    response = Article(api_wrapper).info(article_id)
+
+    assert isinstance(response, dict), "The resonse should be a dict"
+    assert set(article_keys).issubset(response.keys()), "All keys should be in the response"
+    assert isinstance(response['article_id'], int), "Article id should be an integer"
+    assert isinstance(response['article_title'], str), "Article title should be a str"
+    assert isinstance(response['newspaper_id'], int), "Newspaper id should be an integer"
+    assert isinstance(response['newspaper_name'], str), "Newspaper name should be a string"
+    assert isinstance(response['author_name'], str), "Author name should be a string"
+    assert isinstance(response['author_id'], int), "Author id should be an integer"
+    assert isinstance(response['region_name'], str), "Region name should be a string"
+    assert isinstance(response['region_id'], int), "Region id should be an integer"
+    assert isinstance(response['content_text'], str), "Content text should be a string"
+    assert isinstance(response['content_html'], str), "Content html should be a string"
+    assert isinstance(response['language'], str), "Language should be a string"