Philipp Wolfer
b7d9809506
Hard coded fake "token" in unit test is not a security issue
2023-09-22 07:30:22 +02:00
Laurent Monin
5d486c94fc
WebService: add more tests for queryargs and unencoded_queryargs
2023-06-09 10:20:20 +02:00
Laurent Monin
16ff3c5c97
Move few functions to new webservice.utils and introduce set_minimum_delay_for_url()
...
- it limits the need to import hostkey_from_url()
- it reduces the size of webservice.py
- it reduces dependencies between files
2023-06-08 16:44:15 +02:00
Laurent Monin
2e54681fd6
Introduce host_port_to_url()
...
This method will help with the move, since we have in many places just host & port (including in Options dialog).
Basically it does its best to convert it to an URL.
2023-06-08 16:44:15 +02:00
Laurent Monin
d10397d30a
Introduce hostkey_from_url()
...
It calculates (host, port) from passed URL.
With matching tests.
2023-06-08 16:44:15 +02:00
Laurent Monin
f7151e17f7
Move code returning port from QUrl outside WSRequest
...
- it will be needed elsewhere
- add matching tests
2023-06-08 16:44:15 +02:00
Laurent Monin
d4e4641837
WSRequest: (re-)introduce queryargs optional parameter to ease adding query params
2023-06-08 16:44:15 +02:00
Laurent Monin
04fb24deb0
Add tests for WebService.*_url() new methods
2023-06-08 16:44:15 +02:00
Laurent Monin
76154e0b78
Introduce WSRequest.has_auth and simplify _update_authorization_header
...
Add matching tests
2023-06-03 19:41:17 +02:00
Laurent Monin
bdd31ab5a4
Complete tests for WSRequest
...
- 100% coverage of the class
2023-06-03 17:08:18 +02:00
Laurent Monin
8d1e304fbe
Add minimal testing for WSRequest
2023-06-03 15:05:12 +02:00
Laurent Monin
91a0618a48
qurl -> url, and convert to Qurl is passed as a string
2023-06-03 14:48:59 +02:00
Laurent Monin
8bb5457f4f
Simplify tests, pass QUrl to WSRequest
2023-06-03 14:23:14 +02:00
Laurent Monin
3d6554a958
Replace assert with if / raise AssertionError
...
- check path & handler aren't None either
- use a generic dummy_handler method for tests
2023-06-03 11:06:29 +02:00
Laurent Monin
3d95051ecf
Enforce keywords arguments only for WSRequest and drop WS*Request subclasses
...
- using only keyword arguments will ease future changes
- order of arguments do not matter anymore
- this class isn't used directly for now, I don't think any plugin uses it
- subclasses aren't strictly needed
- since methods have a lot of parameters, making them obvious is much easier to read
- we can pass a dict (**kwargs)
- note the use of * in __init__() enforcing keyword args only.
- use few asserts as safety for "mandatory" arguments
2023-06-02 22:44:49 +02:00
Laurent Monin
2f6479747d
Update headers
2022-02-07 09:41:57 +01:00
Philipp Wolfer
c5662606cc
PICARD-2332: Use PyQt5 scoped enums
...
This will ease the transition to Qt6
2022-01-14 18:28:01 +01:00
Philipp Wolfer
54f7ad5f44
Extract queuing code from WebService into RequestPriorityQueue class
...
Eases testing and reduces the webservice class complexity.
2021-11-28 17:19:28 +01:00
Laurent Monin
14ce07756e
Update Copyright headers, with the help of fix-headers.py script
2021-11-10 21:38:54 +01:00
Philipp Wolfer
c0e6243a13
PICARD-1926: Adjust test cases for new config structure
2020-12-25 12:37:15 +01:00
Philipp Wolfer
bbcd54ea27
PICARD-1390: Set webservice transfer timeout on config changes
...
Avoid reading the config on each request
2020-10-11 11:45:45 +02:00
Philipp Wolfer
ff2c62c024
PICARD-534: Add support for SOCKS proxy
2020-10-10 17:04:40 +02:00
Laurent Monin
6b5e852a60
Run fix-header on *.py
2020-02-24 10:25:09 +01:00
Philipp Wolfer
5fcbb89a0b
Fixed typo occured -> occurred
2019-09-25 11:46:58 +02:00
Philipp Wolfer
dc0ec84401
isort: Consistently use two blank lines after import
2019-04-04 08:35:23 +02:00
Philipp Wolfer
dd4da2aa47
Updated isort config to put test imports in separate section
2019-04-04 08:32:22 +02:00
Wieland Hoffmann
e624aa121c
Make PicardTestCase the parent class of all tests
...
This brings the faketagger and, more importantly, settings reset to all of them.
2018-10-23 17:32:50 +02:00
Laurent Monin
5329e3592a
Clean up and sort imports using isort
...
Add a config for isort (https://github.com/timothycrosley/isort )
Run isort -rc . and make import style consistent across files
Add a note about `isort` in CONTRIBUTING.md
2018-08-22 08:51:25 +02:00
Laurent Monin
8df1e78af4
Move throttling code to its own file
...
API is modified to use methods to get/set delays, instead of setting global variables
2018-01-29 18:24:56 +01:00
Sambhav Kothari
83e423f0a2
Fix tests with new POST refactoring
2017-07-20 21:34:31 +05:30
Sambhav Kothari
d3edb87f53
Fix WS tests for the new changes
2017-07-20 20:07:46 +05:30
Sambhav Kothari
029a6882e1
Add more tests for the webservice
2017-07-13 16:42:57 +05:30
Wieland Hoffmann
452a78aaf6
Don't use assert_called
...
It's only available in Python 3.6+
2017-07-10 20:34:16 +02:00
Wieland Hoffmann
690e385255
Use unittest.mock instead of mock
...
mock is not part of the standard library, only unittest.mock is.
2017-07-10 20:26:35 +02:00
Sambhav Kothari
9df404172a
Add more tests for WebService
2017-07-10 15:58:49 +05:30
Sambhav Kothari
dcaa3f4e84
Add basic code to test Webservice
2017-07-09 21:37:52 +05:30