Sha256: bb1ffc237012fa43d3bd56cad875553d400b940bcebdf1e6023c0f92653be2b6

Contents?: true

Size: 1.36 KB

Versions: 2

Compression:

Stored size: 1.36 KB

Contents

require 'test_helper'

require 'docusign_api'

class DocusignApiTest < Minitest::Test
  def setup
    stub_docusign_login
    @api = DocusignApi.new username: 'username', password: 'password', integrator_key: '12345', login_url: 'https://demo.docusign.net/restapi/v2/login_information'
  end

  def test_get
    url = File.join(DOCUSIGN_ACCOUNT_BASE_URL, 'templates')
    @req = stub_request(:get, url).
      with(headers: DOCUSIGN_DEFAULT_HEADERS).
      to_return( status: 200, body: '{}' )

    @api.get '/templates'
    assert_requested @req
  end

  def test_post
    url = File.join(DOCUSIGN_ACCOUNT_BASE_URL, 'templates')
    @req = stub_request(:post, url).
      with(headers: DOCUSIGN_DEFAULT_HEADERS, body: '{}').
      to_return( status: 200, body: '{}' )

    @api.post '/templates', '{}'
    assert_requested @req
  end

  def test_put
    url = File.join(DOCUSIGN_ACCOUNT_BASE_URL, 'templates')
    @req = stub_request(:put, url).
    with(headers: DOCUSIGN_DEFAULT_HEADERS, body: '{}').
    to_return( status: 200, body: '{}' )

    @api.put '/templates', '{}'
    assert_requested @req
  end

  def test_delete
    url = File.join(DOCUSIGN_ACCOUNT_BASE_URL, 'templates')
    @req = stub_request(:delete, url).
      with(headers: DOCUSIGN_DEFAULT_HEADERS).
      to_return( status: 200, body: '{}' )

    @api.delete '/templates', '{}'
    assert_requested @req
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
docusign_api-0.1.2 test/test_docusign_api.rb
docusign_api-0.1.1 test/test_docusign_api.rb