Skip to content

Addуed few unit tests #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ build-iPhoneSimulator/
.rvmrc

tests/docs/private.pem
Gemfile.*
tests/.env
Gemfile.*
3 changes: 1 addition & 2 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
--color
--require spec_helper
--debuger
--default-path 'tests'
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,47 @@ For details regarding which type of OAuth grant will work best for your DocuSign

For security purposes, DocuSign recommends using the [Authorization Code Grant](https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-code-grant) flow.

## Running tests:
Pre-conditions:
1. Make sure ruby is installed or install it fallowing the [instructions](https://www.ruby-lang.org/en/documentation/installation/)
2. Login with your DocuSign account on https://appdemo.docusign.com.
3. Open Apps and Keys section in Settings and press Add App and Integration Key button.
4. Enter App name, add secret key, generate RSA key and press Save button, add `https://developers.docusign.com/` to Redirect URIs.
5. Create new template on https://appdemo.docusign.com/templates page and save its ID.

After complete all previous steps for run on the Windows 10 need to do the following:
1. Download curl from https://curl.se/windows/
2. Inside archive find "bin" directory
3. Rename libcurl-x64.def to libcurl.def
4. Rename libcurl-x64.dll to libcurl.dll
5. Copy all files from "bin" directory to C:\Ruby30-x64\bin

To run tests, you need:
1. Create a .env file at the `tests` dir (or rename an existing .env.example file)
2. Enter your data from the developer account
* `SECRET` \
settings => Apps and Keys =>
Apps and Integration Keys your app "ACTIONS" => Edit =>
Authentication => Secret Keys
* `INTEGRATOR_KEY_JWT` \
settings => Apps and Keys => Integration Key of your app
* `TEMPLATE_ID` \
templates => in MyTemplates list click by chosen template or _create new one_ => template id
* `USER_ID` \
settings => Apps and Keys => User ID

3. Copy private key to `tests/docs/private.pem ` \
Settings => "Apps and Keys"
in Apps and Integration Keys choose your application name => "ACTIONS" Edit => Service Integration => + GENERATE RSA

4. Run tests: \
`cd tests && bundle install`\
`bundle exec rspec spec/unit_tests_using_jwt_spec.rb --format documentation`

### Important note:
First time you ask for a JWT access token you might need to uncomment lines 19-21 in `tests/spec/unit_tests_using_jwt_spec.rb:19` and grant access to the API


## Support
Log issues against this client through GitHub. We also have an [active developer community on Stack Overflow](https://stackoverflow.com/questions/tagged/docusignapi).

Expand All @@ -48,4 +89,4 @@ The DocuSign eSignature Ruby Client SDK is licensed under the [MIT License](http
* [DocuSign Developer Center](https://developers.docusign.com/)
* [DocuSign API on Twitter](https://twitter.com/docusignapi)
* [DocuSign For Developers on LinkedIn](https://www.linkedin.com/showcase/docusign-for-developers/)
* [DocuSign For Developers on YouTube](https://www.youtube.com/channel/UCJSJ2kMs_qeQotmw4-lX2NQ)
* [DocuSign For Developers on YouTube](https://www.youtube.com/channel/UCJSJ2kMs_qeQotmw4-lX2NQ)
2 changes: 2 additions & 0 deletions docusign_esign.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Gem::Specification.new do |s|
s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2'
s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.11'
s.add_development_dependency 'dotenv', '~> 2.1', '>= 2.1.1'
s.add_development_dependency 'launchy', '~> 2.5'

s.files = `find *`.split("\n").uniq.sort.select{|f| !f.empty? }
s.test_files = `find spec/*`.split("\n")
Expand Down
5 changes: 5 additions & 0 deletions tests/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
RECIPIENT_EMAIL = 'email@example.com'
SECRET = 'xxx'
INTEGRATOR_KEY_JWT='xxx'
TEMPLATE_ID = 'xxx'
USER_ID='xxx'
Loading