Skip to content

Commit

Permalink
Update user-agent (#31)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
pcothenet and kleinjm authored Aug 30, 2021
1 parent 3279130 commit dd51608
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.10.0] - 2021-08-27

### Added

- Adds a custom User-Agent header

## [1.9.0] - 2021-08-17

### Added
Expand Down
2 changes: 1 addition & 1 deletion patch_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from __future__ import absolute_import

__version__ = "1.9.0"
__version__ = "1.10.0"

# import ApiClient
from patch_api.api_client import ApiClient
Expand Down
2 changes: 1 addition & 1 deletion patch_api/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def __init__(
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = "OpenAPI-Generator/1.9.0/python"
self.user_agent = "patch-python/1.10.0"

def __del__(self):
if self._pool:
Expand Down
4 changes: 3 additions & 1 deletion patch_api/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,9 @@ def to_debug_report(self):
"OS: {env}\n"
"Python Version: {pyversion}\n"
"Version of the API: v1\n"
"SDK Package Version: 1.9.0".format(env=sys.platform, pyversion=sys.version)
"SDK Package Version: 1.10.0".format(
env=sys.platform, pyversion=sys.version
)
)

def get_host_settings(self):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from setuptools import setup, find_packages # noqa: H301

NAME = "patch-api"
VERSION = "1.9.0"
VERSION = "1.10.0"
# To install the library, run the following
#
# python setup.py install
Expand Down
16 changes: 8 additions & 8 deletions test/test_estimates_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ def test_create_and_retrieve_flight_estimate(self):
Create an estimate based on the distance in meters flown by an airplane # noqa: E501
"""
distance_m = 10000000
distance_m = 1000000
estimate = self.api.create_flight_estimate(
distance_m=distance_m, create_order=True
)
self.assertEqual(estimate.data.type, "flight")
self.assertEqual(estimate.data.order.mass_g, 1000622)
self.assertEqual(estimate.data.mass_g, 1000622)
self.assertGreater(estimate.data.order.mass_g, 50000)
self.assertGreater(estimate.data.mass_g, 50000)

retrieved_estimate = self.api.retrieve_estimate(id=estimate.data.id)
self.assertTrue(retrieved_estimate)
Expand All @@ -75,7 +75,7 @@ def test_create_and_retrieve_shipping_estimate(self):
)
self.assertEqual(estimate.data.order, None)
self.assertEqual(estimate.data.type, "shipping")
self.assertEqual(estimate.data.mass_g, 249)
self.assertGreater(estimate.data.mass_g, 200)

retrieved_estimate = self.api.retrieve_estimate(id=estimate.data.id)
self.assertTrue(retrieved_estimate)
Expand All @@ -85,15 +85,15 @@ def test_create_and_retrieve_vehicle_estimate(self):
Create an estimate based on the vehicle distance, transportation method, and package mass # noqa: E501
"""
distance_m = 10000000
distance_m = 1000000
make = "Toyota"
model = "Corolla"
year = 1995
estimate = self.api.create_vehicle_estimate(
distance_m=distance_m, model=model, make=make, year=year
)
self.assertEqual(estimate.data.type, "vehicle")
self.assertEqual(estimate.data.mass_g, 5719674)
self.assertGreater(estimate.data.mass_g, 50000)

retrieved_estimate = self.api.retrieve_estimate(id=estimate.data.id)
self.assertTrue(retrieved_estimate)
Expand All @@ -103,14 +103,14 @@ def test_create_and_retrieve_vehicle_estimate_best_match(self):
Create an estimate based on the vehicle with partial information # noqa: E501
"""
distance_m = 10000000
distance_m = 1000000
make = "Toyota"
model = "Corolla"
estimate = self.api.create_vehicle_estimate(
distance_m=distance_m, model=model, make=make
)
self.assertEqual(estimate.data.type, "vehicle")
self.assertEqual(estimate.data.mass_g, 6499629)
self.assertGreater(estimate.data.mass_g, 50000)

retrieved_estimate = self.api.retrieve_estimate(id=estimate.data.id)
self.assertTrue(retrieved_estimate)
Expand Down

0 comments on commit dd51608

Please sign in to comment.