22import requests_mock
33from streampot import StreamPot , JobEntity , JobStatus
44
5+
56@pytest .fixture
67def stream_pot ():
78 return StreamPot (secret = 'test_secret' )
89
10+
911def test_initialization (stream_pot ):
1012 assert stream_pot .secret == 'test_secret'
1113 assert stream_pot .base_url == 'https://api.streampot.io/v1'
1214 assert isinstance (stream_pot .actions , list )
1315 assert len (stream_pot .actions ) == 0
1416
15- def test_check_status (stream_pot ):
17+
18+ def test_get_job (stream_pot ):
1619 with requests_mock .Mocker () as m :
17- job_id = ' 123'
20+ job_id = 123
1821 mock_url = f"{ stream_pot .base_url } /jobs/{ job_id } "
1922 mock_response = {'id' : 123 , 'status' : 'completed' , 'created_at' : '2020-01-01' }
2023 m .get (mock_url , json = mock_response )
2124
22- response = stream_pot .check_status (job_id )
25+ response = stream_pot .get_job (job_id )
2326 assert response == mock_response
2427
28+
2529def test_run (stream_pot ):
2630 with requests_mock .Mocker () as m :
2731 mock_url = f"{ stream_pot .base_url } /"
@@ -34,15 +38,17 @@ def test_run(stream_pot):
3438 assert response .status == JobStatus .PENDING
3539 assert response .created_at == '2020-01-02'
3640
41+
3742def test_add_action (stream_pot ):
3843 stream_pot .merge_add ('source_video.mp4' )
3944 assert len (stream_pot .actions ) == 1
4045 assert stream_pot .actions [0 ]['name' ] == 'mergeAdd'
4146 assert stream_pot .actions [0 ]['value' ] == ('source_video.mp4' ,)
4247
48+
4349@pytest .mark .parametrize ("method, expected_action" , [
4450 ("merge_add" , 'mergeAdd' ),
45- # ("add_input", 'addInput'),
51+ ("add_input" , 'addInput' ),
4652 # add more methods and expected actions as necessary
4753])
4854def test_actions (stream_pot , method , expected_action ):
0 commit comments