test/unit/peddler/test_client.rb in peddler-0.7.7 vs test/unit/peddler/test_client.rb in peddler-0.7.8
- old
+ new
@@ -1,10 +1,10 @@
require 'helper'
require 'excon'
require 'peddler/client'
-class ClientTest < MiniTest::Test
+class PeddlerClientTest < MiniTest::Test
module Parser
def self.parse(res, *); res; end
end
def setup
@@ -12,11 +12,16 @@
Excon.defaults[:mock] = true
Excon.stub({}, body: @body, status: 200)
@klass = Class.new(Peddler::Client)
@client = @klass.new
- @client.marketplace_id = 'A1F83G8C2ARO7P'
+
+ @client.aws_access_key_id = 'key'
+ @client.aws_secret_access_key = 'secret'
+ @client.merchant_id = 'seller'
+ @client.marketplace_id = 'ATVPDKIKX0DER' # US
+
@client.operation('Foo')
end
def teardown
Excon.stubs.clear
@@ -44,9 +49,14 @@
@client.configure do |config|
config.aws_access_key_id = '123'
end
assert_equal '123', @client.aws_access_key_id
+ end
+
+ def test_configures_when_initialising
+ client = @klass.new(aws_access_key_id: '123')
+ assert_equal '123', client.aws_access_key_id
end
def test_guards_against_bad_marketplace_id
assert_raises(Peddler::Client::BadMarketplaceId) do
client = Peddler::Client.new