mirror of
https://github.com/bellingcat/polyphemus.git
synced 2026-06-11 12:58:31 +03:00
added unit tests and made keyword arguments more consistent
This commit is contained in:
44
tests/api.py
Normal file
44
tests/api.py
Normal file
@@ -0,0 +1,44 @@
|
||||
# -*- coding: UTF-8 -*-
|
||||
|
||||
"""Tests for to polyphemus.api module.
|
||||
|
||||
The full set of tests for this module can be evaluated by executing the
|
||||
command::
|
||||
|
||||
$ python -m pytest tests/api.py
|
||||
|
||||
from the project root directory.
|
||||
|
||||
"""
|
||||
|
||||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
|
||||
|
||||
import pytest
|
||||
|
||||
from polyphemus import api
|
||||
|
||||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
|
||||
|
||||
KWARGS_LIST = [
|
||||
('get_channel_info', ['channel_name']),
|
||||
('get_subscribers', ['channel_id']),
|
||||
('get_all_videos', ['channel_id']),
|
||||
('get_views', ['video_id']),
|
||||
('get_video_reactions', ['video_id']),
|
||||
('get_all_comments', ['video_id']),
|
||||
('append_comment_reactions', ['comment_info_list']),
|
||||
('normalized_name_to_video_info', ['normalized_name']),
|
||||
('get_streaming_url', ['canonical_url']),
|
||||
('get_recommended', ['video_title', 'video_id']),]
|
||||
|
||||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
|
||||
|
||||
@pytest.mark.parametrize( 'function_str,kwargs', KWARGS_LIST )
|
||||
def test_minimal_init( resources, function_str, kwargs ):
|
||||
|
||||
function = eval( f'api.{function_str}')
|
||||
function_kwargs = { kwarg : resources[ kwarg ] for kwarg in kwargs }
|
||||
|
||||
function( **function_kwargs )
|
||||
|
||||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
|
||||
Reference in New Issue
Block a user