Commit Graph

8 Commits

Author SHA1 Message Date
Aarni Koskela d50cc429c2 Enable Ruff I (import sort), autofix
Signed-off-by: Aarni Koskela <akx@iki.fi>
2024-01-03 21:28:56 +02:00
Anthony Sottile 5fcc293ba2 use python3.6+ constructs
Signed-off-by: Anthony Sottile <asottile@umich.edu>
2021-07-05 18:30:07 -04:00
Anca Iordache 64fdb32ae8 Implement context management, lifecycle and unittests.
Signed-off-by: Anca Iordache <anca.iordache@docker.com>
2020-02-05 14:49:42 +01:00
Sebastiaan van Stijn 219c52141e
Regression 443 test: relax status-code check
This test was testing for a 500 status, but this status
is actually a bug in the API (as it's due to an invalid
request), and the API should actually return a 400 status.

To make this test handle both situations, relax the test
to accept either a 4xx or 5xx status.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-09 21:23:11 +01:00
Constantine Peresypkin b20f800db6 fixes create_api_error_from_http_exception()
`create_api_error_from_http_exception()` is never tested in the original code
and will fail miserably when fed with empty `HTTPError` object
see fixes in requests for this behaviour: https://github.com/requests/requests/pull/3179

Signed-off-by: Constantine Peresypkin <pconstantine@gmail.com>
2017-12-18 17:15:48 +02:00
Artem Bolshakov 62fda980e4 client.containers.run returns None if none of json-file or journald logging drivers used
Signed-off-by: Artem Bolshakov <either.free@gmail.com>
2017-08-17 13:38:40 -07:00
alex-dr e0e7404380 Fix APIError status_code property for client/server errors
requests.Response objects evaluate as falsy when the status_code
attribute is in the 400-500 range. Therefore we are assured that
prior to this change, APIError would show `is_server_error() == False`
when generated with a 500-level response and `is_client_error() == False`
when generated with a 400-level response. This is not desirable.

Added some seemingly dry (not DRY) unit tests to ensure nothing silly
slips back in here.

Signed-off-by: alex-dr <alex@datarobot.com>
2017-03-22 00:49:07 -04:00
Ben Firshman 1984f68730
Add new user-focused API
See #1086

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-22 17:05:43 +00:00