Sha256: 3a3d7ab939e61ea950bc519a5d5ba01b30ea49bc977fd4b5b7a4d87d046d93d9

Contents?: true

Size: 1.23 KB

Versions: 9

Compression:

Stored size: 1.23 KB

Contents

$:.unshift 'lib'
$LOAD_PATH << File.dirname(__FILE__)

require 'helper'
require 'upwork/api/logger'
require 'upwork/api/config'
require 'upwork/api/client'
require 'test/unit'
require 'mocha/test_unit'

class ConfigTest < Test::Unit::TestCase
  include TestHelper
  
  def test_config_initialization
    config = Upwork::Api::Config.new({
      'client_id'     => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
      'client_secret' => 'xxxxxxxxxxxxxxxx',
      'redirect_uri'  => 'https://a.redirect.uri',
      'access_token'  => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
      'refresh_token' => 'xxxxxxxxxxxxxxxx',
      'debug'         => false
    })
    
    client = Upwork::Api::Client.new(config)
    client.epoint = 'gds'

    assert_equal '/ab/account-security/oauth2/authorize',client.url_auth
    assert_equal '/api/v3/oauth2/token',client.url_rtoken
    assert_equal '/api/v3/oauth2/token',client.url_atoken
    assert_equal 'gds',client.epoint 
  end
  
  def test_get
    assert get_client_mock.get('/some/api/url')
  end
  
  def test_post
    assert get_client_mock.post('/some/api/url', {})
  end
  
  def test_put
    assert get_client_mock.put('/some/api/url', {})
  end
  
  def test_delete
    assert get_client_mock.delete('/some/api/url', {})
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ruby-upwork-oauth2-2.3.0 test/test_client.rb
ruby-upwork-oauth2-2.2.0 test/test_client.rb
ruby-upwork-oauth2-2.1.4 test/test_client.rb
ruby-upwork-oauth2-2.1.3 test/test_client.rb
ruby-upwork-oauth2-2.1.2 test/test_client.rb
ruby-upwork-oauth2-2.1.1 test/test_client.rb
ruby-upwork-oauth2-2.1.0 test/test_client.rb
ruby-upwork-oauth2-2.0.1 test/test_client.rb
ruby-upwork-oauth2-2.0.0 test/test_client.rb