Skip to content

Commit b84292d

Browse files
authored
Make test less brittle (#43)
1 parent da9b23a commit b84292d

File tree

8 files changed

+47
-12
lines changed

8 files changed

+47
-12
lines changed

Diff for: 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.15.1] - 2021-11-04
9+
10+
### Added
11+
12+
- Adds verifier to project responses
13+
814
## [1.15.0] - 2021-10-04
915

1016
### Added

Diff for: 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.15.0"
18+
__version__ = "1.15.1"
1919

2020
# import ApiClient
2121
from patch_api.api_client import ApiClient

Diff for: patch_api/api_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def __init__(
9292
self.default_headers[header_name] = header_value
9393
self.cookie = cookie
9494
# Set default User-Agent.
95-
self.user_agent = "patch-python/1.15.0"
95+
self.user_agent = "patch-python/1.15.1"
9696

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

Diff for: patch_api/configuration.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ 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.15.0".format(
344+
"SDK Package Version: 1.15.1".format(
345345
env=sys.platform, pyversion=sys.version
346346
)
347347
)

Diff for: patch_api/models/order.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def state(self, state):
281281
def allocation_state(self):
282282
"""Gets the allocation_state of this Order. # noqa: E501
283283
284-
The current state of the allocated carbon offsets of the order. # noqa: E501
284+
DEPRECATED. Indicates if the order has been fully allocated to projects. # noqa: E501
285285
286286
:return: The allocation_state of this Order. # noqa: E501
287287
:rtype: str
@@ -292,7 +292,7 @@ def allocation_state(self):
292292
def allocation_state(self, allocation_state):
293293
"""Sets the allocation_state of this Order.
294294
295-
The current state of the allocated carbon offsets of the order. # noqa: E501
295+
DEPRECATED. Indicates if the order has been fully allocated to projects. # noqa: E501
296296
297297
:param allocation_state: The allocation_state of this Order. # noqa: E501
298298
:type: str

Diff for: patch_api/models/project.py

+31-2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class Project(object):
4848
"photos": "list[Photo]",
4949
"average_price_per_tonne_cents_usd": "int",
5050
"remaining_mass_g": "int",
51+
"verifier": "str",
5152
"standard": "Standard",
5253
"sdgs": "list[Sdg]",
5354
"tagline": "str",
@@ -69,6 +70,7 @@ class Project(object):
6970
"photos": "photos",
7071
"average_price_per_tonne_cents_usd": "average_price_per_tonne_cents_usd",
7172
"remaining_mass_g": "remaining_mass_g",
73+
"verifier": "verifier",
7274
"standard": "standard",
7375
"sdgs": "sdgs",
7476
"tagline": "tagline",
@@ -91,6 +93,7 @@ def __init__(
9193
photos=None,
9294
average_price_per_tonne_cents_usd=None,
9395
remaining_mass_g=None,
96+
verifier=None,
9497
standard=None,
9598
sdgs=None,
9699
tagline=None,
@@ -116,6 +119,7 @@ def __init__(
116119
self._photos = None
117120
self._average_price_per_tonne_cents_usd = None
118121
self._remaining_mass_g = None
122+
self._verifier = None
119123
self._standard = None
120124
self._sdgs = None
121125
self._tagline = None
@@ -138,6 +142,8 @@ def __init__(
138142
self.photos = photos
139143
self.average_price_per_tonne_cents_usd = average_price_per_tonne_cents_usd
140144
self.remaining_mass_g = remaining_mass_g
145+
if verifier is not None:
146+
self.verifier = verifier
141147
self.standard = standard
142148
self.sdgs = sdgs
143149
if tagline is not None:
@@ -524,11 +530,34 @@ def remaining_mass_g(self, remaining_mass_g):
524530

525531
self._remaining_mass_g = remaining_mass_g
526532

533+
@property
534+
def verifier(self):
535+
"""Gets the verifier of this Project. # noqa: E501
536+
537+
The name of the project verifier. A verifier is the organization that verifies the calculations of the actual amount of greenhouse gas emissions that have been avoided or sequestered through implementation of the project. # noqa: E501
538+
539+
:return: The verifier of this Project. # noqa: E501
540+
:rtype: str
541+
"""
542+
return self._verifier
543+
544+
@verifier.setter
545+
def verifier(self, verifier):
546+
"""Sets the verifier of this Project.
547+
548+
The name of the project verifier. A verifier is the organization that verifies the calculations of the actual amount of greenhouse gas emissions that have been avoided or sequestered through implementation of the project. # noqa: E501
549+
550+
:param verifier: The verifier of this Project. # noqa: E501
551+
:type: str
552+
"""
553+
554+
self._verifier = verifier
555+
527556
@property
528557
def standard(self):
529558
"""Gets the standard of this Project. # noqa: E501
530559
531-
An object returning the Standard associated with this project. # noqa: E501
560+
An object returning the Standard associated with this project. Standards provide guidance on GHG quantification, monitoring, and reporting. Standards can include protocols/methodologies and guidance documents. # noqa: E501
532561
533562
:return: The standard of this Project. # noqa: E501
534563
:rtype: Standard
@@ -539,7 +568,7 @@ def standard(self):
539568
def standard(self, standard):
540569
"""Sets the standard of this Project.
541570
542-
An object returning the Standard associated with this project. # noqa: E501
571+
An object returning the Standard associated with this project. Standards provide guidance on GHG quantification, monitoring, and reporting. Standards can include protocols/methodologies and guidance documents. # noqa: E501
543572
544573
:param standard: The standard of this Project. # noqa: E501
545574
:type: Standard

Diff for: 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.15.0"
15+
VERSION = "1.15.1"
1616
# To install the library, run the following
1717
#
1818
# python setup.py install

Diff for: test/test_projects_api.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ def test_retrieve_projects(self):
7070
self.assertGreater(project.average_price_per_tonne_cents_usd, 0)
7171
self.assertGreater(project.remaining_mass_g, 0)
7272
self.assertEqual(project.standard, None)
73-
self.assertRegex(project.name, r"Test Offset Project")
73+
self.assertIsInstance(project.name, str)
7474
self.assertTrue(project.description)
75-
self.assertEqual(project.country, "US")
76-
self.assertEqual(project.type, "biomass")
77-
self.assertEqual(project.developer, "Patch Sandbox Supplier Test")
75+
self.assertIsInstance(project.country, str)
76+
self.assertIsInstance(project.type, str)
77+
self.assertIsInstance(project.developer, str)
7878
self.assertTrue(isinstance(project.photos, list))
7979

8080
def test_retrieve_biomass_projects(self):

0 commit comments

Comments
 (0)