@@ -13,10 +13,11 @@ class TestUploader(unittest.TestCase):
1313 host = 'https://in.logtail.com'
1414 source_token = 'dummy_source_token'
1515 frame = [1 , 2 , 3 ]
16+ timeout = 30
1617
1718 @patch ('logtail.uploader.requests.Session.post' )
1819 def test_call (self , post ):
19- def mock_post (endpoint , data = None , headers = None ):
20+ def mock_post (endpoint , data = None , headers = None , timeout = None ):
2021 # Check that the data is sent to ther correct endpoint
2122 self .assertEqual (endpoint , self .host )
2223 # Check the content-type
@@ -25,9 +26,11 @@ def mock_post(endpoint, data=None, headers=None):
2526 self .assertEqual ('application/msgpack' , headers .get ('Content-Type' ))
2627 # Check the content was msgpacked correctly
2728 self .assertEqual (msgpack .unpackb (data , raw = False ), self .frame )
29+ # Check that timeout is passed to the request
30+ self .assertEqual (timeout , 30 )
2831
2932 post .side_effect = mock_post
30- u = Uploader (self .source_token , self .host )
33+ u = Uploader (self .source_token , self .host , self . timeout )
3134 u (self .frame )
3235
3336 self .assertTrue (post .called )
0 commit comments