diff --git a/.github/workflows/build-wheel.yml b/.github/workflows/build-wheel.yml new file mode 100644 index 0000000..784428b --- /dev/null +++ b/.github/workflows/build-wheel.yml @@ -0,0 +1,36 @@ +on: + push: + branches: + - main + - develop + +jobs: + build_wheel: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Build wheel and install + run: | + python -m pip install --user --upgrade build + python -m build + - name: archive build artifacts + uses: actions/upload-artifact@v3 + with: + name: dist-files + path: dist/* +# #pip install . +# find ./dist/*.whl | xargs pip install +# python simple_test.py +# - name: Configure Git +# run: | +# git config --global user.email "apwheele@gmail.com" +# git config --global user.name "apwheele" +# - name: Commit and push wheel +# run: | +# git add -f ./dist/*.whl +# git commit -m 'pushing new wheel' +# git push diff --git a/.github/workflows/helper-tests.yml b/.github/workflows/helper-tests.yml new file mode 100644 index 0000000..c6b1e4e --- /dev/null +++ b/.github/workflows/helper-tests.yml @@ -0,0 +1,50 @@ +name: PyTests + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10"] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + + with: + python-version: ${{ matrix.python-version }} + + - name: Cache pip modules + id: cache-pip + uses: actions/cache@v3 + env: + cache-name: cache-pip-modules + with: + path: ~/.cache/pip + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('requirements.txt') }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + + - name: Test BundleHelper + run: | + pytest ./src/blueink/tests/test_bundle_helper.py + + - name: Test PersonHelper + run: | + pytest ./src/blueink/tests/test_person_helper.py diff --git a/.github/workflows/style-checks.yml b/.github/workflows/style-checks.yml new file mode 100644 index 0000000..84ecd8a --- /dev/null +++ b/.github/workflows/style-checks.yml @@ -0,0 +1,14 @@ +name: Style Checks + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: psf/black@stable + with: + options: "--check --verbose" + src: "./src" + version: "~= 22.0" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5ed79b8..65f3e28 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,18 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks repos: - - repo: https://github.com/psf/black - rev: 22.10.0 - hooks: - - id: black - language_version: python3.9 + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-added-large-files + - repo: https://github.com/psf/black + rev: 22.10.0 + hooks: + - id: black + language_version: python3.9 + - repo: https://github.com/PyCQA/isort + rev: 5.10.1 + hooks: + - id: isort diff --git a/README.md b/README.md index 010f5f5..a7a4329 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,15 @@ # blueink-client-python +![Tests](https://github.com/blueinkhq/blueink-client-python/actions/workflows/helper-tests.yml/badge.svg) +![Style Checks](https://github.com/blueinkhq/blueink-client-python/actions/workflows/style-checks.yml/badge.svg) +[![PyPI version](https://badge.fury.io/py/blueink-client-python.svg)](https://pypi.org/project/blueink-client-python/) +![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg) A Python client library for the BlueInk eSignature API. ## Overview This README provides a narrative overview of using the Blueink Python client, and -includes examples for many common use cases. +includes examples for many common use cases. Additional resources that might be useful include: @@ -31,7 +35,7 @@ pip install blueink-client-python Requests to the Blueink API are made via an instance of the `blueink.Client` class. The `blueink.Client` needs a Blueink private API key. By default the Client looks for -the private key in an environment variable named `BLUEINK_PRIVATE_API_KEY`. +the private key in an environment variable named `BLUEINK_PRIVATE_API_KEY`. ```bash # In your shell, or in .bashrc or similar @@ -61,8 +65,8 @@ exceptions whenever there's an issue between the client and server (eg. HTTP4xx, HTTP5xx errors). These come from the `requests` module. If within your application you already handle exceptions coming out of `requests` then you should be good. If you set `raise_exceptions = False` then these will be returned as -`NormalizedResponse` objects which are also used for successful communications. See -below for information about these objects. +`NormalizedResponse` objects which are also used for successful communications. See +below for information about these objects. ```python # In your python code, create an instance of the blueink Client @@ -84,16 +88,17 @@ for bundle in bundles: print(bundle.id) ``` -The Client class follows a RESTful pattern for making API calls, like so: +The Client class follows a RESTful pattern for making API calls, like so: `client.[resource].[method]`. The supported "resources" are: * `bundles` * `persons` - * `packets` + * `packets` * `templates` + * `webhooks` - The methods correspond to common REST operations: + The methods correspond to common REST operations: * `list()` * `retrieve()` * `create()` @@ -101,9 +106,9 @@ The supported "resources" are: * `delete()` However, note that: -* Not all resources support all methods. -* Some resources support one-off methods that are unique to that resource. - For example the `bundles` resource allows you to retrieve a list of events on +* Not all resources support all methods. +* Some resources support one-off methods that are unique to that resource. + For example the `bundles` resource allows you to retrieve a list of events on the Bundle by calling `client.bundles.list_events()`. Detailed documentation for each resource is below. @@ -115,18 +120,18 @@ the following attributes. * **response.data** - The json data returned via the API call is accessible via the `data` attribute. The - `data` attribute supports dictionary access and dot-notation access (for convenience + The json data returned via the API call is accessible via the `data` attribute. The + `data` attribute supports dictionary access and dot-notation access (for convenience and less typing). ```python response = client.bundles.retrieve("some bundle ID") - + bundle_data = response.data print(bundle_data['id']) # dictionary-style access print(bundle_data.id) # dot notation access ``` - + * **response.request** The request that led to this response. Under-the-hood, the Blueink client library @@ -135,19 +140,19 @@ the following attributes. * **response.original_response** - Similarly, if you need access to the original response as returned by + Similarly, if you need access to the original response as returned by the Python Requests library, it's accessible as `original_response`. * **response.pagination** - Most API calls that return a list of data returned paginated results. If so, - information about the pagination is included in the `pagination` attribute. + Most API calls that return a list of data returned paginated results. If so, + information about the pagination is included in the `pagination` attribute. Pagination Example: ```python response = client.persons.list() - + pagination = response.pagination print(pagination.page_number, ' - current page number') print(pagination.total_pages, ' - total pages') @@ -162,7 +167,7 @@ See "Requests that Return Lists > Pagination" below. #### Filtering and Searching Some Blueink [API endpoints](https://blueink.com/r/api-docs/) support searching and / or -filtering. In those cases, you can pass querystring parameters to the `list(...)` or +filtering. In those cases, you can pass querystring parameters to the `list(...)` or `paged_list(...)` method on those resources. For example: @@ -184,7 +189,7 @@ statuses = ",".join([ response = client.bundles.list(status__in=statuses) complete_or_started_bundles = response.data -# Retrieve Bundles matching a search of "example.com" (which will match signer email +# Retrieve Bundles matching a search of "example.com" (which will match signer email # addresses). We can pass pagination parameters too. response = client.bundles.list(per_page=10, page=2, search="example.com") matching_bundles = response.data @@ -199,19 +204,19 @@ for paged_response in iterator: #### Pagination Blueink API calls that return a list of results are paginated - ie, if there -are a lot of results, you need to make multiple requests to retrieve all of those -results, including a `page_number` parameter (and optionally a `page_size` parameter) +are a lot of results, you need to make multiple requests to retrieve all of those +results, including a `page_number` parameter (and optionally a `page_size` parameter) in each request. -The details of Blueink pagination scheme can be found in the +The details of Blueink pagination scheme can be found in the [API documentation](https://blueink.com/r/api-docs/pagination/): This client library provides convenience methods to make looping over paginated results easier. Whenever there is a `list()` method available for a resource, there is a corresponding `paged_list()` method available that returns a -`PaginatedIterator` helper class to make processing the results easier. +`PaginatedIterator` helper class to make processing the results easier. -You can mostly ignore the details of how the `PaginatedIterator` works. Instead, here +You can mostly ignore the details of how the `PaginatedIterator` works. Instead, here is an example of looping over a paginated set of Bundles: ```python @@ -227,13 +232,13 @@ for paged_response in iterator: ## Client Method Index Parameters can be found using autocomplete within your IDE. Creates/Updates take a -Python dictionary as the data field, unless special named methods like -```create_from_bundle_helper``` indicate otherwise. List methods can take query params +Python dictionary as the data field, unless special named methods like +```create_from_bundle_helper``` indicate otherwise. List methods can take query params as kwargs. ### Bundle Related * Create via ```client.bundles.create(...)``` or ```client.bundles.create_from_bundle_helper(...)``` -* List via ```client.bundles.list(...)``` or ```client.bundles.paged_list(...)``` +* List via ```client.bundles.list(...)``` or ```client.bundles.paged_list(...)``` * Retrieve via ```client.bundles.retrieve(...)``` * Cancel via ```client.bundles.cancel(...)``` * List Events via ```client.bundles.list_events(...)``` @@ -242,7 +247,7 @@ as kwargs. ### Person Related * Create via ```client.persons.create(...)``` or ```client.persons.create_from_person_helper(...)``` -* List via ```client.persons.list(...)``` or ```client.persons.paged_list(...)``` +* List via ```client.persons.list(...)``` or ```client.persons.paged_list(...)``` * Retrieve via ```client.persons.retrieve(...)``` * Delete via ```client.persons.delete(...)``` * Update via ```client.persons.update(...)``` @@ -254,7 +259,7 @@ as kwargs. * Remind via ```client.packets.remind(...)``` ### Template Related -* List via ```client.templates.list(...)``` or ```client.templates.paged_list(...)``` +* List via ```client.templates.list(...)``` or ```client.templates.paged_list(...)``` * Retrieve via ```client.templates.retrieve(...)``` ### Webhook Related @@ -266,18 +271,18 @@ as kwargs. * Delete via ```client.webhooks.delete(...)``` * Update via ```client.webhooks.update(...)``` -####WebhookExtraHeader Client Methods +#### WebhookExtraHeader Client Methods * Create via ```client.webhooks.create_header(...)``` * List via ```client.webhooks.list_headers(...)``` * Retrieve via ```client.webhooks.retrieve_header(...)``` * Delete via ```client.webhooks.delete_header(...)``` * Update via ```client.webhooks.update_header(...)``` -####WebhookEvent Client Methods +#### WebhookEvent Client Methods * List via ```client.webhooks.list_events(...)``` * Retrieve via ```client.webhooks.retrieve_event(...)``` -####WebhookDelivery Client Methods +#### WebhookDelivery Client Methods * List via ```client.webhooks.list_deliveries(...)``` * Retrieve via ```client.webhooks.retrieve_delivery(...)``` @@ -287,8 +292,8 @@ as kwargs. #### Creating Bundles with the BundleHelper -When creating a Bundle via the API, you need to pass quite a bit of data in the -`client.bundle.create(...)` request. To ease the construction of that data, this +When creating a Bundle via the API, you need to pass quite a bit of data in the +`client.bundle.create(...)` request. To ease the construction of that data, this library provides a `BundleHelper` class. Below is an example of using `BundleHelper` to create a Bundle with 1 document, @@ -610,7 +615,7 @@ template_response = client.templates.retrieve(template_id) ``` ### Webhooks -Webhooks can be interacted with via several methods. Webhooks also have related objects, such as +Webhooks can be interacted with via several methods. Webhooks also have related objects, such as ```WebhookExtraHeaders```, ```WebhookEvents```, and ```WebhookDeliveries``` which have their own methods to interact with. @@ -650,7 +655,7 @@ client = Client() # Attempt posting a new Webhook # -------------- try: - create_resp = client.webhooks.create_webhook(data=WEBHOOK_01) + create_resp = client.webhooks.create(data=WEBHOOK_01) webhook = create_resp.data print(f"Created webhook {webhook.id}") except HTTPError as e: diff --git a/__init__.py b/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/pyproject.toml b/pyproject.toml index b0f0765..6f5aca5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,9 @@ [build-system] requires = ["setuptools>=42"] build-backend = "setuptools.build_meta" + +[tool.black] +line-length = 88 + +[tool.isort] +profile = "black" diff --git a/requirements/dev.txt b/requirements/dev.txt new file mode 100644 index 0000000..561cab7 --- /dev/null +++ b/requirements/dev.txt @@ -0,0 +1 @@ +pre-commit==2.20.0 diff --git a/setup.cfg b/setup.cfg index 9a97d1b..6993d4a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = blueink-client-python -version = 0.9.3 +version = 0.9.4 author = Blueink author_email = pypi@blueink.com description = Python Client for Blueink eSignature API diff --git a/src/__init__.py b/src/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/blueink/__init__.py b/src/blueink/__init__.py index bffa4c0..43671b0 100644 --- a/src/blueink/__init__.py +++ b/src/blueink/__init__.py @@ -1,8 +1,8 @@ from requests import exceptions -from .client import Client -from .bundle_helper import BundleHelper -from .person_helper import PersonHelper -from . import constants +import blueink.constants +from blueink.bundle_helper import BundleHelper +from blueink.client import Client +from blueink.person_helper import PersonHelper __all__ = ["Client", "BundleHelper", "PersonHelper", "exceptions", "constants"] diff --git a/src/blueink/bundle_helper.py b/src/blueink/bundle_helper.py index 084dd52..59b2286 100644 --- a/src/blueink/bundle_helper.py +++ b/src/blueink/bundle_helper.py @@ -1,9 +1,9 @@ import io -from os.path import basename from base64 import b64encode +from os.path import basename from typing import List -from .model.bundles import ( +from blueink.model.bundles import ( Bundle, Document, Field, @@ -164,7 +164,6 @@ def add_document_template( Returns: document key """ - if template_id in self._documents.keys(): raise RuntimeError( f"Document/Template with id {template_id} already added." diff --git a/src/blueink/client.py b/src/blueink/client.py index 74ee156..1b1923a 100644 --- a/src/blueink/client.py +++ b/src/blueink/client.py @@ -1,16 +1,16 @@ from os import environ -from src.blueink.constants import ( +from blueink.constants import ( DEFAULT_BASE_URL, ENV_BLUEINK_API_URL, ENV_BLUEINK_PRIVATE_API_KEY, ) -from src.blueink.request_helper import RequestHelper -from src.blueink.subclients.bundle import BundleSubClient -from src.blueink.subclients.packet import PacketSubClient -from src.blueink.subclients.person import PersonSubClient -from src.blueink.subclients.template import TemplateSubClient -from src.blueink.subclients.webhook import WebhookSubClient +from blueink.request_helper import RequestHelper +from blueink.subclients.bundle import BundleSubClient +from blueink.subclients.packet import PacketSubClient +from blueink.subclients.person import PersonSubClient +from blueink.subclients.template import TemplateSubClient +from blueink.subclients.webhook import WebhookSubClient class Client: diff --git a/src/blueink/model/bundles.py b/src/blueink/model/bundles.py index 029cfb3..b8b9f61 100644 --- a/src/blueink/model/bundles.py +++ b/src/blueink/model/bundles.py @@ -1,9 +1,10 @@ import random import string from typing import List, Optional -from pydantic import BaseModel, validator, EmailStr -from ..constants import DELIVER_VIA, FIELD_KIND +from pydantic import BaseModel, EmailStr, validator + +from blueink.constants import DELIVER_VIA, FIELD_KIND class ValidationError(RuntimeError): diff --git a/src/blueink/model/webhook.py b/src/blueink/model/webhook.py index 630c95b..9420a8e 100644 --- a/src/blueink/model/webhook.py +++ b/src/blueink/model/webhook.py @@ -1,7 +1,8 @@ from typing import List, Optional -from pydantic import BaseModel, validator, Field -from src.blueink.constants import EVENT_TYPE +from pydantic import BaseModel, Field, validator + +from blueink.constants import EVENT_TYPE class WebhookExtraHeaderSchema(BaseModel): diff --git a/src/blueink/paginator.py b/src/blueink/paginator.py index 18dad2b..8ac51a7 100644 --- a/src/blueink/paginator.py +++ b/src/blueink/paginator.py @@ -1,6 +1,6 @@ from requests.exceptions import HTTPError -from .request_helper import NormalizedResponse +from blueink.request_helper import NormalizedResponse class PaginatedIterator: diff --git a/src/blueink/person_helper.py b/src/blueink/person_helper.py index c316015..b189b7b 100644 --- a/src/blueink/person_helper.py +++ b/src/blueink/person_helper.py @@ -1,6 +1,6 @@ from typing import List -from .model.persons import ContactChannelSchema, PersonSchema +from blueink.model.persons import ContactChannelSchema, PersonSchema class PersonHelper: diff --git a/src/blueink/request_helper.py b/src/blueink/request_helper.py index 5489735..f9843da 100644 --- a/src/blueink/request_helper.py +++ b/src/blueink/request_helper.py @@ -1,9 +1,8 @@ import requests - from munch import munchify from requests import Request, Session -from .constants import BLUEINK_PAGINATION_HEADER +from blueink.constants import BLUEINK_PAGINATION_HEADER class Pagination: diff --git a/src/blueink/subclients/bundle.py b/src/blueink/subclients/bundle.py index 2b17dba..ed41ac3 100644 --- a/src/blueink/subclients/bundle.py +++ b/src/blueink/subclients/bundle.py @@ -4,12 +4,12 @@ from munch import Munch -from src.blueink import endpoints -from src.blueink.bundle_helper import BundleHelper -from src.blueink.constants import BUNDLE_STATUS -from src.blueink.paginator import PaginatedIterator -from src.blueink.request_helper import NormalizedResponse -from src.blueink.subclients.subclient import SubClient +from blueink import endpoints +from blueink.bundle_helper import BundleHelper +from blueink.constants import BUNDLE_STATUS +from blueink.paginator import PaginatedIterator +from blueink.request_helper import NormalizedResponse +from blueink.subclients.subclient import SubClient class BundleSubClient(SubClient): @@ -21,7 +21,6 @@ def _prepare_files(self, file_list: [io.BufferedReader]): if file_list: for idx, file_dict in enumerate(file_list): if "file" in file_dict: - print("Actual File") fh = file_dict["file"] if not isinstance(fh, io.BufferedReader): raise ValueError( @@ -39,6 +38,20 @@ def _prepare_files(self, file_list: [io.BufferedReader]): ), ) ) + elif "file_b64" in file_dict: + b64 = file_dict["file_b64"] + field_name = f"files[{idx}]" + files_data.append( + ( + field_name, + ( + file_dict.get("filename"), + b64, + file_dict.get("content_type"), + ), + ) + ) + return files_data def create( diff --git a/src/blueink/subclients/packet.py b/src/blueink/subclients/packet.py index a76687c..cfcfe32 100644 --- a/src/blueink/subclients/packet.py +++ b/src/blueink/subclients/packet.py @@ -1,6 +1,6 @@ -from src.blueink import endpoints -from src.blueink.request_helper import NormalizedResponse -from src.blueink.subclients.subclient import SubClient +from blueink import endpoints +from blueink.request_helper import NormalizedResponse +from blueink.subclients.subclient import SubClient class PacketSubClient(SubClient): diff --git a/src/blueink/subclients/person.py b/src/blueink/subclients/person.py index 2904235..6189c4b 100644 --- a/src/blueink/subclients/person.py +++ b/src/blueink/subclients/person.py @@ -1,8 +1,8 @@ -from src.blueink import endpoints -from src.blueink.paginator import PaginatedIterator -from src.blueink.person_helper import PersonHelper -from src.blueink.request_helper import NormalizedResponse -from src.blueink.subclients.subclient import SubClient +from blueink import endpoints +from blueink.paginator import PaginatedIterator +from blueink.person_helper import PersonHelper +from blueink.request_helper import NormalizedResponse +from blueink.subclients.subclient import SubClient class PersonSubClient(SubClient): diff --git a/src/blueink/subclients/subclient.py b/src/blueink/subclients/subclient.py index ed67650..13f9523 100644 --- a/src/blueink/subclients/subclient.py +++ b/src/blueink/subclients/subclient.py @@ -1,5 +1,5 @@ -from src.blueink import endpoints -from src.blueink.request_helper import RequestHelper +from blueink import endpoints +from blueink.request_helper import RequestHelper class SubClient: diff --git a/src/blueink/subclients/template.py b/src/blueink/subclients/template.py index 961d943..0613b9a 100644 --- a/src/blueink/subclients/template.py +++ b/src/blueink/subclients/template.py @@ -1,7 +1,7 @@ -from src.blueink import endpoints -from src.blueink.paginator import PaginatedIterator -from src.blueink.request_helper import NormalizedResponse -from src.blueink.subclients.subclient import SubClient +from blueink import endpoints +from blueink.paginator import PaginatedIterator +from blueink.request_helper import NormalizedResponse +from blueink.subclients.subclient import SubClient class TemplateSubClient(SubClient): diff --git a/src/blueink/subclients/webhook.py b/src/blueink/subclients/webhook.py index 14dcbf5..1adac16 100644 --- a/src/blueink/subclients/webhook.py +++ b/src/blueink/subclients/webhook.py @@ -1,6 +1,6 @@ -from src.blueink import endpoints -from src.blueink.request_helper import NormalizedResponse -from src.blueink.subclients.subclient import SubClient +from blueink import endpoints +from blueink.request_helper import NormalizedResponse +from blueink.subclients.subclient import SubClient class WebhookSubClient(SubClient): @@ -10,7 +10,7 @@ def __init__(self, base_url, private_api_key): # ---------- # Webhooks # ---------- - def create_webhook(self, data: dict): + def create(self, data: dict): url = self.build_url(endpoint=endpoints.WEBHOOKS.CREATE) return self._requests.post(url, data=data) diff --git a/src/blueink/tests/test_bundle_helper.py b/src/blueink/tests/test_bundle_helper.py index 9c2dc35..0d4dbd4 100644 --- a/src/blueink/tests/test_bundle_helper.py +++ b/src/blueink/tests/test_bundle_helper.py @@ -1,12 +1,9 @@ import copy -from base64 import b64encode -from os.path import basename from munch import Munch -from src.blueink import BundleHelper, Client -from src.blueink.person_helper import PersonHelper -from src.blueink.utils.testcase import TestCase +from blueink.bundle_helper import BundleHelper +from blueink.utils.testcase import TestCase class TestBundleHelper(TestCase): diff --git a/src/blueink/tests/test_client.py b/src/blueink/tests/test_client.py index ad2b363..de0bebd 100644 --- a/src/blueink/tests/test_client.py +++ b/src/blueink/tests/test_client.py @@ -4,9 +4,11 @@ from time import sleep from munch import Munch -from src.blueink import Client, BundleHelper, PersonHelper -from src.blueink.constants import EVENT_TYPE -from src.blueink.utils.testcase import TestCase + +from blueink import BundleHelper, Client, PersonHelper +from blueink.constants import EVENT_TYPE +from blueink.utils.testcase import TestCase + # ----------------- # Bundle Subclient Tests @@ -330,7 +332,7 @@ def test_webhook_creation_raw(self): data = self.WEBHOOK_01 client = Client(raise_exceptions=False) - resp1 = client.webhooks.create_webhook(data=data) + resp1 = client.webhooks.create(data=data) self.assert_equal(resp1.status, 201, resp1.data) resp_clean1 = client.webhooks.delete(resp1.data.id) @@ -345,11 +347,11 @@ def test_webhook_listing(self): pre_create_len = len(pre_create.data) data1 = self.WEBHOOK_01 - resp1 = client.webhooks.create_webhook(data=data1) + resp1 = client.webhooks.create(data=data1) self.assert_equal(resp1.status, 201, resp1.data) data2 = self.WEBHOOK_02 - resp2 = client.webhooks.create_webhook(data=data2) + resp2 = client.webhooks.create(data=data2) self.assert_equal(resp1.status, 201, resp2.data) post_create = client.webhooks.list() @@ -369,7 +371,7 @@ def test_webhook_retrieval(self): client = Client(raise_exceptions=False) data1 = self.WEBHOOK_01 - resp1 = client.webhooks.create_webhook(data=data1) + resp1 = client.webhooks.create(data=data1) self.assert_equal(resp1.status, 201, resp1.data) self.assert_equal(resp1.data["url"], data1["url"]) @@ -391,7 +393,7 @@ def test_webhook_delete(self): pre_create_len = len(resp0.data) data1 = self.WEBHOOK_01 - resp1 = client.webhooks.create_webhook(data=data1) + resp1 = client.webhooks.create(data=data1) self.assert_equal(resp1.status, 201, resp1.data) resp2 = client.webhooks.list() @@ -412,7 +414,7 @@ def test_webhook_update(self): client = Client(raise_exceptions=False) data1 = self.WEBHOOK_01 - resp1 = client.webhooks.create_webhook(data=data1) + resp1 = client.webhooks.create(data=data1) self.assert_equal(resp1.status, 201, resp1.data) self.assert_equal(resp1.data["url"], data1["url"]) @@ -443,7 +445,7 @@ def test_extraheader_creation_raw(self): data = self.WEBHOOK_01 client = Client(raise_exceptions=False) - resp1 = client.webhooks.create_webhook(data=data) + resp1 = client.webhooks.create(data=data) self.assert_equal(resp1.status, 201, resp1.data) eh_data = deepcopy(self.WEBHOOK_01_EXTRA_HEADER_A) @@ -462,10 +464,10 @@ def test_extraheader_listing(self): client = Client(raise_exceptions=False) # Create parent webhooks - resp1a = client.webhooks.create_webhook(data=data1) + resp1a = client.webhooks.create(data=data1) self.assert_equal(resp1a.status, 201, resp1a.data) - resp1b = client.webhooks.create_webhook(data=data2) + resp1b = client.webhooks.create(data=data2) self.assert_equal(resp1b.status, 201, resp1b.data) # setup and create headers under wh 1 diff --git a/src/blueink/tests/test_person_helper.py b/src/blueink/tests/test_person_helper.py index 1ac1329..7939029 100644 --- a/src/blueink/tests/test_person_helper.py +++ b/src/blueink/tests/test_person_helper.py @@ -1,5 +1,5 @@ -from src.blueink.person_helper import PersonHelper -from src.blueink.utils.testcase import TestCase +from blueink.person_helper import PersonHelper +from blueink.utils.testcase import TestCase class TestPersonHelper(TestCase):