File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 1
1
import json
2
2
import hmac
3
3
import hashlib
4
+ import sys
4
5
5
6
# Import specific modules instead of importing from Monei
6
7
import Monei
16
17
from Monei .exceptions import ApiException
17
18
18
19
19
- DEFAULT_USER_AGENT = f"MONEI/Python/{ Monei .__version__ } "
20
+ DEFAULT_USER_AGENT = f"MONEI/Python/{ Monei .__version__ } (Python v { sys . version_info . major } . { sys . version_info . minor } . { sys . version_info . micro } ) "
20
21
21
22
22
23
class MoneiClient (object ):
Original file line number Diff line number Diff line change 30
30
"lint-staged" : " ^15.4.3" ,
31
31
"release-it" : " ^18.1.2"
32
32
},
33
- "packageManager" : " yarn@4.7.0 "
33
+ "packageManager" : " yarn@4.9.4 "
34
34
}
Original file line number Diff line number Diff line change @@ -267,6 +267,23 @@ def test_default_user_agent_always_set(self):
267
267
# Check that the user agent is set in the API client
268
268
self .assertEqual (client ._api_client .user_agent , DEFAULT_USER_AGENT )
269
269
270
+ def test_default_user_agent_format_includes_python_version (self ):
271
+ """Test that DEFAULT_USER_AGENT includes Python version in the correct format."""
272
+ import sys
273
+ import Monei
274
+
275
+ # Check that the user agent follows the expected format: MONEI/Python/2.0.2 (Python v3.12.9)
276
+ expected_format = f"MONEI/Python/{ Monei .__version__ } (Python v{ sys .version_info .major } .{ sys .version_info .minor } .{ sys .version_info .micro } )"
277
+ self .assertEqual (DEFAULT_USER_AGENT , expected_format )
278
+
279
+ # Verify the format components
280
+ self .assertTrue (DEFAULT_USER_AGENT .startswith ("MONEI/Python/" ))
281
+ self .assertIn (
282
+ f"(Python v{ sys .version_info .major } .{ sys .version_info .minor } .{ sys .version_info .micro } )" ,
283
+ DEFAULT_USER_AGENT ,
284
+ )
285
+ self .assertIn (Monei .__version__ , DEFAULT_USER_AGENT )
286
+
270
287
271
288
if __name__ == "__main__" :
272
289
unittest .main ()
You can’t perform that action at this time.
0 commit comments