-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from Arlula/automatedTests
Version 2.0.3 - Minor Fixes and Unit Testing
- Loading branch information
Showing
14 changed files
with
374 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Test Python Package | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
secrets: | ||
TEST_API_KEY: | ||
required: true | ||
TEST_API_SECRET: | ||
required: true | ||
TEST_API_ORDER_KEY: | ||
required: true | ||
TEST_API_ORDER_EULA: | ||
required: true | ||
TEST_API_HOST: | ||
required: true | ||
TEST_API_ORDER_ID: | ||
required: true | ||
TEST_API_RESOURCE_ID: | ||
required: true | ||
pull_request: | ||
types: [opened,edited,synchronize,reopened,ready_for_review,review_requested,] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
- run: pip3 install -r requirements.txt | ||
- run: python3 -m unittest tests/test_archive.py tests/test_orders.py tests/test_rfc3339.py | ||
env: | ||
API_KEY: ${{ secrets.TEST_API_KEY }} | ||
API_SECRET: ${{ secrets.TEST_API_SECRET }} | ||
API_ORDER_KEY: ${{ secrets.TEST_API_ORDER_KEY}} | ||
API_ORDER_EULA: ${{ secrets.TEST_API_ORDER_EULA }} | ||
API_HOST: ${{ secrets.TEST_API_HOST }} | ||
API_ORDER_ID: ${{ secrets.TEST_API_ORDER_ID }} | ||
API_RESOURCE_ID: ${{ secrets.TEST_API_RESOURCE_ID }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ __pycache__ | |
*.cpython | ||
arlulaapi.egg-info | ||
test.py | ||
credentials.json | ||
credentials.json | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,3 +29,7 @@ | |
from .exception import ( | ||
ArlulaSessionError | ||
) | ||
|
||
from .util import ( | ||
parse_rfc3339 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import re | ||
from datetime import datetime, timezone, timedelta | ||
|
||
__date_rx__ = re.compile(r"^(?P<year>\d{4})-(?P<month>\d\d)-(?P<day>\d\d)[Tt](?P<hour>\d\d):(?P<minute>\d\d):(?P<second>\d\d)(?:\.(?P<sec_frac>\d+))?(?P<offset>(?:[zZ]|(?P<offset_sign>[+-])(?P<offset_hour>\d{2}):(?P<offset_minute>\d{2})))$") | ||
|
||
def parse_rfc3339(dt_str: str) -> datetime: | ||
try: | ||
result = re.search(__date_rx__, dt_str) | ||
|
||
if result.lastindex < 7 or result.lastindex > 11: | ||
return None | ||
|
||
sec_frac_int = 0 | ||
|
||
sec_frac = result["sec_frac"] | ||
if sec_frac is not None: | ||
sec_frac_str = sec_frac[:6] if len(sec_frac) > 6 else sec_frac | ||
sec_frac_int = int(sec_frac_str)*(10**(6 - len(sec_frac_str))) | ||
|
||
tz = timezone(timedelta()) | ||
|
||
if not (result["offset"] == "z" or result["offset"] == "Z"): | ||
|
||
offset_hour = int(result["offset_hour"]) | ||
offset_minute = int(result["offset_minute"]) | ||
|
||
if result["offset_sign"] == "-": | ||
offset_minute *= -1 | ||
offset_hour *= -1 | ||
|
||
tz = timezone(timedelta(hours=offset_hour, minutes=offset_minute)) | ||
|
||
return datetime( | ||
int(result["year"]), | ||
int(result["month"]), | ||
int(result["day"]), | ||
int(result["hour"]), | ||
int(result["minute"]), | ||
int(result["second"]), | ||
sec_frac_int, | ||
tz | ||
) | ||
except: | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
setuptools.setup( | ||
name='arlulacore', | ||
version='2.0.2', | ||
version='2.0.3', | ||
author="Arlula", | ||
author_email="[email protected]", | ||
description="A package to facilitate access to the Arlula Imagery Marketplace API", | ||
|
Oops, something went wrong.