Skip to content

Commit dd51608

Browse files
pcothenetkleinjm
andauthored
Update user-agent (#31)
* Make tests less fragile * Make tests less fragile * Remove unwanted addition * Update User-Agent * Remove comment * Re-add tests * Lint * Update CHANGELOG.md Co-authored-by: James Klein <kleinjm007@gmail.com> Co-authored-by: James Klein <kleinjm007@gmail.com>
1 parent 3279130 commit dd51608

File tree

6 files changed

+20
-12
lines changed

6 files changed

+20
-12
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.10.0] - 2021-08-27
9+
10+
### Added
11+
12+
- Adds a custom User-Agent header
13+
814
## [1.9.0] - 2021-08-17
915

1016
### Added

patch_api/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from __future__ import absolute_import
1717

18-
__version__ = "1.9.0"
18+
__version__ = "1.10.0"
1919

2020
# import ApiClient
2121
from patch_api.api_client import ApiClient

patch_api/api_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __init__(
9191
self.default_headers[header_name] = header_value
9292
self.cookie = cookie
9393
# Set default User-Agent.
94-
self.user_agent = "OpenAPI-Generator/1.9.0/python"
94+
self.user_agent = "patch-python/1.10.0"
9595

9696
def __del__(self):
9797
if self._pool:

patch_api/configuration.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,9 @@ def to_debug_report(self):
341341
"OS: {env}\n"
342342
"Python Version: {pyversion}\n"
343343
"Version of the API: v1\n"
344-
"SDK Package Version: 1.9.0".format(env=sys.platform, pyversion=sys.version)
344+
"SDK Package Version: 1.10.0".format(
345+
env=sys.platform, pyversion=sys.version
346+
)
345347
)
346348

347349
def get_host_settings(self):

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from setuptools import setup, find_packages # noqa: H301
1313

1414
NAME = "patch-api"
15-
VERSION = "1.9.0"
15+
VERSION = "1.10.0"
1616
# To install the library, run the following
1717
#
1818
# python setup.py install

test/test_estimates_api.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ def test_create_and_retrieve_flight_estimate(self):
4848
4949
Create an estimate based on the distance in meters flown by an airplane # noqa: E501
5050
"""
51-
distance_m = 10000000
51+
distance_m = 1000000
5252
estimate = self.api.create_flight_estimate(
5353
distance_m=distance_m, create_order=True
5454
)
5555
self.assertEqual(estimate.data.type, "flight")
56-
self.assertEqual(estimate.data.order.mass_g, 1000622)
57-
self.assertEqual(estimate.data.mass_g, 1000622)
56+
self.assertGreater(estimate.data.order.mass_g, 50000)
57+
self.assertGreater(estimate.data.mass_g, 50000)
5858

5959
retrieved_estimate = self.api.retrieve_estimate(id=estimate.data.id)
6060
self.assertTrue(retrieved_estimate)
@@ -75,7 +75,7 @@ def test_create_and_retrieve_shipping_estimate(self):
7575
)
7676
self.assertEqual(estimate.data.order, None)
7777
self.assertEqual(estimate.data.type, "shipping")
78-
self.assertEqual(estimate.data.mass_g, 249)
78+
self.assertGreater(estimate.data.mass_g, 200)
7979

8080
retrieved_estimate = self.api.retrieve_estimate(id=estimate.data.id)
8181
self.assertTrue(retrieved_estimate)
@@ -85,15 +85,15 @@ def test_create_and_retrieve_vehicle_estimate(self):
8585
8686
Create an estimate based on the vehicle distance, transportation method, and package mass # noqa: E501
8787
"""
88-
distance_m = 10000000
88+
distance_m = 1000000
8989
make = "Toyota"
9090
model = "Corolla"
9191
year = 1995
9292
estimate = self.api.create_vehicle_estimate(
9393
distance_m=distance_m, model=model, make=make, year=year
9494
)
9595
self.assertEqual(estimate.data.type, "vehicle")
96-
self.assertEqual(estimate.data.mass_g, 5719674)
96+
self.assertGreater(estimate.data.mass_g, 50000)
9797

9898
retrieved_estimate = self.api.retrieve_estimate(id=estimate.data.id)
9999
self.assertTrue(retrieved_estimate)
@@ -103,14 +103,14 @@ def test_create_and_retrieve_vehicle_estimate_best_match(self):
103103
104104
Create an estimate based on the vehicle with partial information # noqa: E501
105105
"""
106-
distance_m = 10000000
106+
distance_m = 1000000
107107
make = "Toyota"
108108
model = "Corolla"
109109
estimate = self.api.create_vehicle_estimate(
110110
distance_m=distance_m, model=model, make=make
111111
)
112112
self.assertEqual(estimate.data.type, "vehicle")
113-
self.assertEqual(estimate.data.mass_g, 6499629)
113+
self.assertGreater(estimate.data.mass_g, 50000)
114114

115115
retrieved_estimate = self.api.retrieve_estimate(id=estimate.data.id)
116116
self.assertTrue(retrieved_estimate)

0 commit comments

Comments
 (0)