@@ -108,3 +108,37 @@ def test_prepare_body_form(self):
108
108
# Assert
109
109
self .assertTrue (content_type .startswith ("multipart/form-data" ))
110
110
self .assertIsInstance (body , bytes )
111
+
112
+ def test_prepare_body_file (self ):
113
+ baseClient = BaseClient (TestClientId , TestClientSecret , TestEndpoint )
114
+ file_content = b"test file content"
115
+
116
+ content_type , body = baseClient .prepare_body (file_content , True , True )
117
+
118
+ self .assertTrue (content_type .startswith ("multipart/form-data" ))
119
+ self .assertIsInstance (body , bytes )
120
+ self .assertIn (b"test file content" , body )
121
+
122
+ def test_do_get_bytes_raw_without_check (self ):
123
+ baseClient = BaseClient (TestClientId , TestClientSecret , TestEndpoint )
124
+ mock_response = b'{"key": "value"}'
125
+ url = f"{ TestEndpoint } /api/test"
126
+
127
+ with requests_mock .Mocker () as m :
128
+ m .get (url , content = mock_response )
129
+ result = baseClient .do_get_bytes_raw_without_check (url )
130
+
131
+ self .assertEqual (result , mock_response )
132
+
133
+ def test_do_post_bytes_raw (self ):
134
+ baseClient = BaseClient (TestClientId , TestClientSecret , TestEndpoint )
135
+ mock_response = b'{"status": "success"}'
136
+ url = f"{ TestEndpoint } /api/test"
137
+ content_type = "application/json"
138
+ body = b'{"test": "data"}'
139
+
140
+ with requests_mock .Mocker () as m :
141
+ m .post (url , content = mock_response )
142
+ result = baseClient .do_post_bytes_raw (url , content_type , body )
143
+
144
+ self .assertEqual (result , mock_response )
0 commit comments