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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions openapi-raw.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10114,6 +10114,7 @@ components:
signer:
description: '_t__SignatureRequestResponseAttachment::SIGNER'
type: string
x-int-or-string: true
name:
description: '_t__SignatureRequestResponseAttachment::NAME'
type: string
Expand Down Expand Up @@ -10736,6 +10737,7 @@ components:
description: '_t__TemplateResponseDocumentCustomField::SIGNER'
type: string
nullable: true
x-int-or-string: true
x:
description: '_t__TemplateResponseDocumentCustomField::X'
type: integer
Expand Down Expand Up @@ -10838,6 +10840,7 @@ components:
signer:
description: '_t__TemplateResponseDocumentFormField::SIGNER'
type: string
x-int-or-string: true
x:
description: '_t__TemplateResponseDocumentFormField::X'
type: integer
Expand Down
3 changes: 3 additions & 0 deletions openapi-sdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10726,6 +10726,7 @@ components:
signer:
description: 'The Signer this attachment is assigned to.'
type: string
x-int-or-string: true
name:
description: 'The name of this attachment.'
type: string
Expand Down Expand Up @@ -11355,6 +11356,7 @@ components:
description: 'The signer of the Custom Field. Can be `null` if field is a merge field (assigned to Sender).'
type: string
nullable: true
x-int-or-string: true
x:
description: 'The horizontal offset in pixels for this form field.'
type: integer
Expand Down Expand Up @@ -11470,6 +11472,7 @@ components:
signer:
description: 'The signer of the Form Field.'
type: string
x-int-or-string: true
x:
description: 'The horizontal offset in pixels for this form field.'
type: integer
Expand Down
3 changes: 3 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10704,6 +10704,7 @@ components:
signer:
description: 'The Signer this attachment is assigned to.'
type: string
x-int-or-string: true
name:
description: 'The name of this attachment.'
type: string
Expand Down Expand Up @@ -11333,6 +11334,7 @@ components:
description: 'The signer of the Custom Field. Can be `null` if field is a merge field (assigned to Sender).'
type: string
nullable: true
x-int-or-string: true
x:
description: 'The horizontal offset in pixels for this form field.'
type: integer
Expand Down Expand Up @@ -11448,6 +11450,7 @@ components:
signer:
description: 'The signer of the Form Field.'
type: string
x-int-or-string: true
x:
description: 'The horizontal offset in pixels for this form field.'
type: integer
Expand Down
6 changes: 6 additions & 0 deletions sandbox/python/tests/.config.dist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"BASE_URL": "https://api.hellosign.com/v3",
"API_KEY": "",
"CLIENT_ID": "",
"USE_XDEBUG": 0
}
1 change: 1 addition & 0 deletions sandbox/python/tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.config.json
124 changes: 124 additions & 0 deletions sandbox/python/tests/test_signature_request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
import json
import os
import unittest

from dropbox_sign import ApiClient, Configuration, apis, models, ApiException


class TestSignatureRequest(unittest.TestCase):
def setUp(self):
self.base_path = os.path.dirname(os.path.abspath(__file__)) + "/.."
self.config_merged = self.get_config()

self.configuration = Configuration(
username=self.config_merged["API_KEY"],
host=self.config_merged["BASE_URL"],
)

def get_config(self):
file = open(f'{self.base_path}/tests/.config.dist.json', 'r')
config_dist = json.load(file)
file.close()

file = open(f'{self.base_path}/tests/.config.json', 'r')
config_custom = json.load(file)
file.close()

config_dist.update(config_custom)

return config_dist

def test_send(self):
api_client = ApiClient(self.configuration)
signature_request_api = apis.SignatureRequestApi(api_client)

file = open(f'{self.base_path}/test_fixtures/SignatureRequestSendRequest.json', 'r')
data = json.load(file)
file.close()

send_request = models.SignatureRequestSendRequest.init(data)
send_request.files = [open(f'{self.base_path}/test_fixtures/pdf-sample.pdf', 'rb')]

send_response = signature_request_api.signature_request_send(send_request)

self.assertEqual(
send_request.form_fields_per_document[0].api_id,
send_response.signature_request.custom_fields[0].api_id,
)

self.assertEqual(
send_request.signers[0].email_address,
send_response.signature_request.signatures[0].signer_email_address,
)
self.assertEqual(
send_request.signers[1].email_address,
send_response.signature_request.signatures[1].signer_email_address,
)
self.assertEqual(
send_request.signers[2].email_address,
send_response.signature_request.signatures[2].signer_email_address,
)

get_response = signature_request_api.signature_request_get(
send_response.signature_request.signature_request_id,
)

self.assertEqual(
send_response.signature_request.signature_request_id,
get_response.signature_request.signature_request_id,
)

def test_create_embedded(self):
api_client = ApiClient(self.configuration)
signature_request_api = apis.SignatureRequestApi(api_client)

file = open(f'{self.base_path}/test_fixtures/SignatureRequestCreateEmbeddedRequest.json', 'r')
data = json.load(file)
data["client_id"] = self.config_merged["CLIENT_ID"]
file.close()

send_request = models.SignatureRequestCreateEmbeddedRequest.init(data)
send_request.files = [open(f'{self.base_path}/test_fixtures/pdf-sample.pdf', 'rb')]

send_response = signature_request_api.signature_request_create_embedded(send_request)

self.assertEqual(
send_request.signers[0].email_address,
send_response.signature_request.signatures[0].signer_email_address,
)
self.assertEqual(
send_request.signers[1].email_address,
send_response.signature_request.signatures[1].signer_email_address,
)
self.assertEqual(
send_request.signers[2].email_address,
send_response.signature_request.signatures[2].signer_email_address,
)

embedded_api = apis.EmbeddedApi(api_client)

get_response = embedded_api.embedded_sign_url(
send_response.signature_request.signatures[0].signature_id
)

self.assertNotEquals("", get_response.embedded.sign_url)

def test_send_without_file_error(self):
api_client = ApiClient(self.configuration)
signature_request_api = apis.SignatureRequestApi(api_client)

file = open(f'{self.base_path}/test_fixtures/SignatureRequestSendRequest.json', 'r')
data = json.load(file)
file.close()

send_request = models.SignatureRequestSendRequest.init(data)

try:
signature_request_api.signature_request_send(send_request)
self.assertFalse(True)
except ApiException as e:
self.assertEqual("file", e.data.error.error_path)


if __name__ == '__main__':
unittest.main()
2 changes: 1 addition & 1 deletion sdks/python/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
indent_style = space
indent_size = 2
[*.py]
indent_size = 4
indent_size = 4
38 changes: 38 additions & 0 deletions sdks/python/.github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# NOTE: This file is auto generated by OpenAPI Generator.
# URL: https://openapi-generator.tech
#
# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: dropbox_sign Python package

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- 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
if [ -f test-requirements.txt ]; then pip install -r test-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 with pytest
run: |
pytest
1 change: 1 addition & 0 deletions sdks/python/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,5 @@ target/
#Ipython Notebook
.ipynb_checkpoints

.openapi-generator
/vendor
27 changes: 17 additions & 10 deletions sdks/python/.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
# NOTE: This file is auto generated by OpenAPI Generator.
# URL: https://openapi-generator.tech
#
# ref: https://docs.gitlab.com/ee/ci/README.html
# ref: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml

stages:
- test

.tests:
.pytest:
stage: test
script:
- pip install -r requirements.txt
- pip install -r test-requirements.txt
- pytest --cov=dropbox_sign

test-3.6:
extends: .tests
image: python:3.6-alpine
test-3.7:
extends: .tests
pytest-3.7:
extends: .pytest
image: python:3.7-alpine
test-3.8:
extends: .tests
pytest-3.8:
extends: .pytest
image: python:3.8-alpine
test-3.9:
extends: .tests
pytest-3.9:
extends: .pytest
image: python:3.9-alpine
pytest-3.10:
extends: .pytest
image: python:3.10-alpine
pytest-3.11:
extends: .pytest
image: python:3.11-alpine
3 changes: 0 additions & 3 deletions sdks/python/.openapi-generator-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
git_push.sh
docs/*AllOf*
**/model/*all_of*
Loading