Skip to content

Commit

Permalink
Merge pull request #22 from W24-Service-GmbH/werk24/issue21
Browse files Browse the repository at this point in the history
allows caller to override license envs. Closes #21
  • Loading branch information
werk24 authored Jan 11, 2021
2 parents bdfc98f + 1b46a09 commit 4aecc77
Show file tree
Hide file tree
Showing 5 changed files with 222 additions and 135 deletions.
Binary file modified .coverage
Binary file not shown.
4 changes: 2 additions & 2 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests | python3.7 | python3.8
name: Tests | cpython 3.7, 3.8, 3.9

on:
push:
Expand All @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8]
python-version: [3.7, 3.8, 3.9]
fail-fast: false

steps:
Expand Down
234 changes: 125 additions & 109 deletions coverage.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" ?>
<coverage version="5.3" timestamp="1607678313205" lines-valid="832" lines-covered="786" line-rate="0.9447" branches-covered="0" branches-valid="0" branch-rate="0" complexity="0">
<coverage version="5.3" timestamp="1607682353912" lines-valid="848" lines-covered="802" line-rate="0.9458" branches-covered="0" branches-valid="0" branch-rate="0" complexity="0">
<!-- Generated by coverage.py: https://coverage.readthedocs.io -->
<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
<sources>
<source>/home/jay/Documents/werk24/werk24-python</source>
</sources>
<packages>
<package name="test" line-rate="0.9779" branch-rate="0" complexity="0">
<package name="test" line-rate="0.9783" branch-rate="0" complexity="0">
<classes>
<class name="__init__.py" filename="test/__init__.py" complexity="0" line-rate="1" branch-rate="0">
<methods/>
Expand All @@ -31,7 +31,7 @@
<line number="37" hits="1"/>
</lines>
</class>
<class name="techread_auth_client_test.py" filename="test/techread_auth_client_test.py" complexity="0" line-rate="0.9487" branch-rate="0">
<class name="techread_auth_client_test.py" filename="test/techread_auth_client_test.py" complexity="0" line-rate="0.9512" branch-rate="0">
<methods/>
<lines>
<line number="1" hits="1"/>
Expand All @@ -43,36 +43,38 @@
<line number="8" hits="1"/>
<line number="9" hits="1"/>
<line number="10" hits="1"/>
<line number="11" hits="1"/>
<line number="13" hits="1"/>
<line number="15" hits="1"/>
<line number="19" hits="1"/>
<line number="22" hits="1"/>
<line number="29" hits="1"/>
<line number="12" hits="1"/>
<line number="14" hits="1"/>
<line number="18" hits="1"/>
<line number="21" hits="1"/>
<line number="28" hits="1"/>
<line number="31" hits="1"/>
<line number="32" hits="1"/>
<line number="33" hits="1"/>
<line number="34" hits="0"/>
<line number="36" hits="1"/>
<line number="44" hits="1"/>
<line number="47" hits="1"/>
<line number="48" hits="1"/>
<line number="49" hits="1"/>
<line number="50" hits="1"/>
<line number="53" hits="1"/>
<line number="33" hits="0"/>
<line number="35" hits="1"/>
<line number="42" hits="1"/>
<line number="43" hits="1"/>
<line number="46" hits="1"/>
<line number="54" hits="1"/>
<line number="55" hits="0"/>
<line number="57" hits="1"/>
<line number="58" hits="1"/>
<line number="59" hits="1"/>
<line number="60" hits="1"/>
<line number="63" hits="1"/>
<line number="64" hits="1"/>
<line number="65" hits="0"/>
<line number="68" hits="1"/>
<line number="70" hits="1"/>
<line number="71" hits="1"/>
<line number="73" hits="1"/>
<line number="77" hits="1"/>
<line number="78" hits="1"/>
<line number="84" hits="1"/>
<line number="80" hits="1"/>
<line number="81" hits="1"/>
<line number="83" hits="1"/>
<line number="87" hits="1"/>
<line number="91" hits="1"/>
<line number="92" hits="1"/>
<line number="99" hits="1"/>
<line number="88" hits="1"/>
<line number="94" hits="1"/>
<line number="97" hits="1"/>
<line number="101" hits="1"/>
<line number="102" hits="1"/>
<line number="109" hits="1"/>
</lines>
</class>
<class name="techread_client_test.py" filename="test/techread_client_test.py" complexity="0" line-rate="0.9756" branch-rate="0">
Expand Down Expand Up @@ -175,7 +177,7 @@
</class>
</classes>
</package>
<package name="werk24" line-rate="0.8613" branch-rate="0" complexity="0">
<package name="werk24" line-rate="0.8673" branch-rate="0" complexity="0">
<classes>
<class name="__init__.py" filename="werk24/__init__.py" complexity="0" line-rate="1" branch-rate="0">
<methods/>
Expand Down Expand Up @@ -269,7 +271,7 @@
<line number="57" hits="1"/>
</lines>
</class>
<class name="techread_client.py" filename="werk24/techread_client.py" complexity="0" line-rate="0.885" branch-rate="0">
<class name="techread_client.py" filename="werk24/techread_client.py" complexity="0" line-rate="0.8976" branch-rate="0">
<methods/>
<lines>
<line number="22" hits="1"/>
Expand All @@ -287,104 +289,118 @@
<line number="39" hits="1"/>
<line number="42" hits="1"/>
<line number="45" hits="1"/>
<line number="60" hits="1"/>
<line number="61" hits="1"/>
<line number="70" hits="1"/>
<line number="71" hits="1"/>
<line number="72" hits="1"/>
<line number="73" hits="1"/>
<line number="62" hits="1"/>
<line number="63" hits="1"/>
<line number="65" hits="1"/>
<line number="74" hits="1"/>
<line number="75" hits="1"/>
<line number="76" hits="1"/>
<line number="82" hits="1"/>
<line number="111" hits="1"/>
<line number="77" hits="1"/>
<line number="80" hits="1"/>
<line number="86" hits="1"/>
<line number="115" hits="1"/>
<line number="118" hits="1"/>
<line number="119" hits="1"/>
<line number="122" hits="1"/>
<line number="125" hits="1"/>
<line number="141" hits="1"/>
<line number="142" hits="1"/>
<line number="143" hits="1"/>
<line number="144" hits="1"/>
<line number="149" hits="1"/>
<line number="152" hits="1"/>
<line number="155" hits="1"/>
<line number="157" hits="1"/>
<line number="168" hits="1"/>
<line number="126" hits="1"/>
<line number="129" hits="1"/>
<line number="145" hits="1"/>
<line number="146" hits="1"/>
<line number="147" hits="1"/>
<line number="148" hits="1"/>
<line number="153" hits="1"/>
<line number="156" hits="1"/>
<line number="159" hits="1"/>
<line number="161" hits="1"/>
<line number="172" hits="1"/>
<line number="175" hits="1"/>
<line number="200" hits="1"/>
<line number="208" hits="1"/>
<line number="211" hits="1"/>
<line number="176" hits="1"/>
<line number="179" hits="1"/>
<line number="204" hits="1"/>
<line number="212" hits="1"/>
<line number="214" hits="1"/>
<line number="215" hits="1"/>
<line number="221" hits="1"/>
<line number="222" hits="1"/>
<line number="223" hits="0"/>
<line number="224" hits="0"/>
<line number="216" hits="1"/>
<line number="218" hits="1"/>
<line number="219" hits="1"/>
<line number="225" hits="1"/>
<line number="226" hits="1"/>
<line number="270" hits="1"/>
<line number="271" hits="1"/>
<line number="227" hits="0"/>
<line number="228" hits="0"/>
<line number="230" hits="1"/>
<line number="274" hits="1"/>
<line number="275" hits="1"/>
<line number="278" hits="1"/>
<line number="286" hits="1"/>
<line number="297" hits="1"/>
<line number="302" hits="1"/>
<line number="303" hits="1"/>
<line number="279" hits="1"/>
<line number="282" hits="1"/>
<line number="290" hits="1"/>
<line number="301" hits="1"/>
<line number="306" hits="1"/>
<line number="312" hits="1"/>
<line number="313" hits="1"/>
<line number="323" hits="0"/>
<line number="324" hits="0"/>
<line number="337" hits="1"/>
<line number="340" hits="1"/>
<line number="349" hits="1"/>
<line number="352" hits="1"/>
<line number="307" hits="1"/>
<line number="310" hits="1"/>
<line number="316" hits="1"/>
<line number="317" hits="1"/>
<line number="327" hits="0"/>
<line number="328" hits="0"/>
<line number="341" hits="1"/>
<line number="344" hits="1"/>
<line number="353" hits="1"/>
<line number="358" hits="1"/>
<line number="360" hits="1"/>
<line number="361" hits="1"/>
<line number="384" hits="1"/>
<line number="385" hits="1"/>
<line number="386" hits="1"/>
<line number="391" hits="1"/>
<line number="395" hits="1"/>
<line number="400" hits="1"/>
<line number="356" hits="1"/>
<line number="357" hits="1"/>
<line number="362" hits="1"/>
<line number="364" hits="1"/>
<line number="365" hits="1"/>
<line number="383" hits="1"/>
<line number="387" hits="1"/>
<line number="388" hits="1"/>
<line number="389" hits="1"/>
<line number="397" hits="1"/>
<line number="401" hits="1"/>
<line number="405" hits="1"/>
<line number="413" hits="1"/>
<line number="422" hits="0"/>
<line number="423" hits="0"/>
<line number="432" hits="1"/>
<line number="434" hits="1"/>
<line number="454" hits="1"/>
<line number="459" hits="1"/>
<line number="463" hits="1"/>
<line number="464" hits="1"/>
<line number="467" hits="0"/>
<line number="468" hits="0"/>
<line number="471" hits="0"/>
<line number="472" hits="0"/>
<line number="474" hits="1"/>
<line number="495" hits="1"/>
<line number="498" hits="1"/>
<line number="499" hits="1"/>
<line number="503" hits="1"/>
<line number="504" hits="0"/>
<line number="510" hits="0"/>
<line number="408" hits="1"/>
<line number="409" hits="1"/>
<line number="441" hits="1"/>
<line number="445" hits="1"/>
<line number="446" hits="1"/>
<line number="449" hits="1"/>
<line number="450" hits="1"/>
<line number="451" hits="1"/>
<line number="452" hits="1"/>
<line number="457" hits="1"/>
<line number="460" hits="1"/>
<line number="465" hits="1"/>
<line number="474" hits="0"/>
<line number="475" hits="0"/>
<line number="484" hits="1"/>
<line number="486" hits="1"/>
<line number="506" hits="1"/>
<line number="511" hits="1"/>
<line number="515" hits="1"/>
<line number="516" hits="0"/>
<line number="518" hits="1"/>
<line number="520" hits="1"/>
<line number="521" hits="1"/>
<line number="541" hits="1"/>
<line number="542" hits="1"/>
<line number="543" hits="1"/>
<line number="516" hits="1"/>
<line number="519" hits="0"/>
<line number="520" hits="0"/>
<line number="523" hits="0"/>
<line number="524" hits="0"/>
<line number="526" hits="1"/>
<line number="547" hits="1"/>
<line number="550" hits="1"/>
<line number="551" hits="1"/>
<line number="557" hits="1"/>
<line number="558" hits="1"/>
<line number="564" hits="1"/>
<line number="568" hits="1"/>
<line number="555" hits="1"/>
<line number="556" hits="0"/>
<line number="562" hits="0"/>
<line number="567" hits="1"/>
<line number="568" hits="0"/>
<line number="570" hits="1"/>
<line number="572" hits="1"/>
<line number="573" hits="1"/>
<line number="593" hits="1"/>
<line number="594" hits="1"/>
<line number="595" hits="1"/>
<line number="602" hits="1"/>
<line number="603" hits="1"/>
<line number="609" hits="1"/>
<line number="610" hits="1"/>
<line number="616" hits="1"/>
<line number="620" hits="1"/>
</lines>
</class>
<class name="techread_client_https.py" filename="werk24/techread_client_https.py" complexity="0" line-rate="0.8028" branch-rate="0">
Expand Down
14 changes: 12 additions & 2 deletions test/techread_auth_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
import aiounittest
import boto3
from botocore.exceptions import ClientError
from botocore.stub import Stubber
from werk24._version import __version__
from werk24.auth_client import AuthClient
from werk24.exceptions import UnauthorizedException
from werk24.exceptions import LicenseError, UnauthorizedException
from werk24.models.techread import W24TechreadRequest
from werk24.techread_client import W24TechreadClient

Expand All @@ -33,6 +32,17 @@ async def test_license_invalid(self):
async with client:
pass

async def test_license_path_invalid(self):
""" Test Invalid License Path File
User Story: As API user, I want to obtain an exception
when the path to the license file as invalid, so that
I can update it.
"""
with self.assertRaises(LicenseError):
client = W24TechreadClient.make_from_env(license_path="/invalid_path")


async def test_cognito_error(self):
""" Test UnauthorizedException if Cognito Identity is unavailable
Expand Down
Loading

0 comments on commit 4aecc77

Please sign in to comment.