Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

v1.4.1
------

- Fix comparision expiry date not resepected
- Minor documentation update

v1.4.0
------

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ Instances of the `ComparisonsEndpoint` class provide the following methods for r
- If specified, the provided expiry time must be UTC and in the future
- If unspecified or `None`, the comparison will never expire (but may be explicitly deleted)

**Note: The comparision must be retrieved via the `comparisons.get(<identifier>)` call to check the 'ready' status for new comparisons. This is an important
step before exporting or accessing consecutive comparisons in any code loops.**

The following exceptions may be raised:

- `BadRequest`
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.0
1.4.1
6 changes: 4 additions & 2 deletions draftable/endpoints/comparisons/comparisons.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def create(self, left, right, identifier=None, public=False, expires=None):
"left": data_from_side("left", left),
"right": data_from_side("right", right),
"public": public,
"expires": expires.isoformat() if expires is not None else None,
"expiry_time": expires.isoformat() if expires is not None else None,
}

return comparison_from_response(self.__client.post(self.__url, data))
Expand Down Expand Up @@ -105,6 +105,8 @@ def signed_viewer_url(
)

param_wait = "&wait" if wait else ""
params = f"?valid_until={valid_until_timestamp}&signature={signature}{param_wait}"
params = (
f"?valid_until={valid_until_timestamp}&signature={signature}{param_wait}"
)

return str(self.__url / "viewer" / self.account_id / identifier + params)
7 changes: 5 additions & 2 deletions draftable/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from draftable import PRODUCTION_CLOUD_BASE_URL, Client, generate_identifier, make_side
from draftable.endpoints.comparisons import signing
from draftable.endpoints.validation import validate_valid_until
from draftable.endpoints.validation import validate_expires, validate_valid_until
from draftable.utilities import aware_datetime_to_timestamp


Expand Down Expand Up @@ -124,12 +124,15 @@ def test_create_retrieve_export_delete(comparisons, exports):


def test_create_from_files(comparisons, exports):
when = datetime.datetime.now() + datetime.timedelta(days=1)

comparison = comparisons.create(
left="test-files/hello.pdf",
right="test-files/hello.pdf",
expires=datetime.datetime.now() + datetime.timedelta(days=1),
expires=when,
)
assert not comparison.failed
assert comparison.expiry_time == validate_expires(when)


def test_create_from_files_txt(comparisons, exports):
Expand Down