Skip to content

Commit 3949579

Browse files
Merge branch 'master' into CPS-67-v18
2 parents de1570c + 362eb46 commit 3949579

File tree

6 files changed

+84
-6
lines changed

6 files changed

+84
-6
lines changed

CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Connect SDK Changes History
22

3+
## v17.6
4+
5+
* Fix: `ServerErrorResponseSchema` has a wrong errors field definition, it must be a list of strings.
6+
* Fix: `function_log` decorator use list comprehension to set a custom formatter for each logging handler configured for the current logger. Changed to a for loop.
7+
38
## v17.5
49

510
* Fix: UsageFileAction's subclass SubmitUsageFile has a rejection note, a parameter which should go in RejectUsageFile instead.

README.md

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Connect Python SDK allows an easy and fast integration with Connect fulfillment
66

77
Please check the documentation available [here](https://connect-python-sdk.readthedocs.io), which contains information on how to install and use the library, and a complete API reference guide.
88

9-
### Main Features
9+
## Main Features
1010

1111
This library may be consumed in your project in order to automate the fulfillment of requests, this class once imported into your project will allow you to:
1212

@@ -29,14 +29,48 @@ This library may be consumed in your project in order to automate the fulfillmen
2929

3030
Your code may use any scheduler to execute, from a simple cron to a cloud scheduler like the ones available in Azure, Google, Amazon or other cloud platforms.
3131

32-
### Installation
32+
## Installation
3333

3434
```sh
3535
$ pip install connect-sdk
3636
```
3737

38-
### Requirements
38+
## Requirements
3939

4040
* Python 2.7+ or Python 3.4+
4141
* Requests (https://pypi.org/project/requests/)
4242
* Marshmallow (https://pypi.org/project/marshmallow/)
43+
44+
## Contribute
45+
46+
If you want to contribute to the connect-python-sdk development feel free to open issues or fork the github repository and submit your pull request.
47+
48+
## Development
49+
50+
### Getting started
51+
52+
Assuming that you have python and virtualenv installed, and forked the connect-python-sdk repository, set up your environment and install the required dependencies like this:
53+
54+
```sh
55+
$ git clone https://github.com/{your_github_account}/connect-python-sdk.git
56+
$ cd connect-python-sdk
57+
$ virtualenv venv
58+
$ . venv/bin/activate
59+
$ pip install -r requirements/test.txt
60+
```
61+
62+
### Running tests
63+
64+
The connect-python-sdk uses [pytest](https://docs.pytest.org/en/latest/) for unit testing.
65+
66+
To run the entire tests suite execute:
67+
68+
```sh
69+
$ pytest
70+
```
71+
72+
## License
73+
74+
The connect-python-sdk is released under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
75+
76+

connect/logger/logger.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def function_log(custom_logger=None):
2222
custom_logger = logging.getLogger()
2323
sformat = " %(levelname)-6s; %(asctime)s; %(name)-6s; %(module)s:%(funcName)s:line" \
2424
"-%(lineno)d: %(message)s"
25-
[handler.setFormatter(logging.Formatter(sformat, "%I:%M:%S"))
26-
for handler in custom_logger.handlers]
25+
for handler in custom_logger.handlers:
26+
handler.setFormatter(logging.Formatter(sformat, "%I:%M:%S"))
2727

2828
# noinspection PyUnusedLocal
2929
def decorator(func, **kwargs):

connect/models/schemas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ def make_object(self, data):
475475
class ServerErrorResponseSchema(BaseSchema):
476476
error_code = fields.Str()
477477
params = fields.Dict()
478-
errors = fields.Str(many=True)
478+
errors = fields.List(fields.Str())
479479

480480
@post_load
481481
def make_object(self, data):
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"errors": [
3+
"error_str_1",
4+
"error_str_2"
5+
],
6+
"error_code": "ERR_000",
7+
"params": {
8+
"param1": "value",
9+
"param2": false,
10+
"param3": ["a", "b", "c"],
11+
"param4": {
12+
"key": "value"
13+
},
14+
"param5": 10
15+
}
16+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# This file is part of the Ingram Micro Cloud Blue Connect SDK.
4+
# Copyright (c) 2019 Ingram Micro. All Rights Reserved.
5+
6+
import os
7+
8+
from connect.models import ServerErrorResponse
9+
from .common import load_str
10+
11+
12+
server_error_response_content = load_str(
13+
os.path.join(os.path.dirname(__file__), 'data', 'response_server_error.json'))
14+
15+
16+
def test_server_error_response_attributes():
17+
# type: () -> None
18+
srv_error = ServerErrorResponse.deserialize(server_error_response_content)
19+
assert isinstance(srv_error, ServerErrorResponse)
20+
assert srv_error.error_code == 'ERR_000'
21+
assert isinstance(srv_error.errors, list)
22+
assert len(srv_error.errors) == 2
23+
assert isinstance(srv_error.params, dict)

0 commit comments

Comments
 (0)