test/unit/mws/test_subscriptions_client.rb in peddler-1.6.7 vs test/unit/mws/test_subscriptions_client.rb in peddler-2.0.0
- old
+ new
@@ -4,32 +4,15 @@
require 'mws/subscriptions/client'
class TestMWSSubscriptionsClient < MiniTest::Test
def setup
@client = MWS::Subscriptions::Client.new
- @client.primary_marketplace_id = '123'
end
def test_registers_destination
operation = {
'Action' => 'RegisterDestination',
- 'MarketplaceId' => '123',
- 'Destination.DeliveryChannel' => 'SQS',
- 'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
- 'Destination.AttributeList.member.1.Value' => 'foo'
- }
-
- @client.stub(:run, nil) do
- @client.register_destination('foo')
- end
-
- assert_equal operation, @client.operation
- end
-
- def test_registers_destination_with_alternate_marketplace
- operation = {
- 'Action' => 'RegisterDestination',
'MarketplaceId' => '321',
'Destination.DeliveryChannel' => 'SQS',
'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
'Destination.AttributeList.member.1.Value' => 'foo'
}
@@ -49,11 +32,11 @@
'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
'Destination.AttributeList.member.1.Value' => 'foo'
}
@client.stub(:run, nil) do
- @client.deregister_destination('foo')
+ @client.deregister_destination('foo', '123')
end
assert_equal operation, @client.operation
end
@@ -74,23 +57,10 @@
end
def test_lists_registered_destinations
operation = {
'Action' => 'ListRegisteredDestinations',
- 'MarketplaceId' => '123'
- }
-
- @client.stub(:run, nil) do
- @client.list_registered_destinations
- end
-
- assert_equal operation, @client.operation
- end
-
- def test_lists_registered_destinations_with_alternate_marketplace
- operation = {
- 'Action' => 'ListRegisteredDestinations',
'MarketplaceId' => '321'
}
@client.stub(:run, nil) do
@client.list_registered_destinations('321')
@@ -100,26 +70,10 @@
end
def test_sends_test_notification_to_destination
operation = {
'Action' => 'SendTestNotificationToDestination',
- 'MarketplaceId' => '123',
- 'Destination.DeliveryChannel' => 'SQS',
- 'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
- 'Destination.AttributeList.member.1.Value' => 'foo'
- }
-
- @client.stub(:run, nil) do
- @client.send_test_notification_to_destination('foo')
- end
-
- assert_equal operation, @client.operation
- end
-
- def test_send_test_notification_to_destination_with_alternate_marketplace
- operation = {
- 'Action' => 'SendTestNotificationToDestination',
'MarketplaceId' => '321',
'Destination.DeliveryChannel' => 'SQS',
'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
'Destination.AttributeList.member.1.Value' => 'foo'
}
@@ -132,28 +86,10 @@
end
def test_creates_subscription
operation = {
'Action' => 'CreateSubscription',
- 'MarketplaceId' => '123',
- 'Subscription.IsEnabled' => true,
- 'Subscription.NotificationType' => 'foo',
- 'Subscription.Destination.DeliveryChannel' => 'SQS',
- 'Subscription.Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
- 'Subscription.Destination.AttributeList.member.1.Value' => 'bar'
- }
-
- @client.stub(:run, nil) do
- @client.create_subscription('foo', 'bar')
- end
-
- assert_equal operation, @client.operation
- end
-
- def test_creates_subscription_with_alternate_marketplace
- operation = {
- 'Action' => 'CreateSubscription',
'MarketplaceId' => '321',
'Subscription.IsEnabled' => true,
'Subscription.NotificationType' => 'foo',
'Subscription.Destination.DeliveryChannel' => 'SQS',
'Subscription.Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
@@ -168,27 +104,10 @@
end
def test_gets_subscription
operation = {
'Action' => 'GetSubscription',
- 'MarketplaceId' => '123',
- 'NotificationType' => 'foo',
- 'Destination.DeliveryChannel' => 'SQS',
- 'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
- 'Destination.AttributeList.member.1.Value' => 'bar'
- }
-
- @client.stub(:run, nil) do
- @client.get_subscription('foo', 'bar')
- end
-
- assert_equal operation, @client.operation
- end
-
- def test_gets_subscription_with_alternate_marketplace
- operation = {
- 'Action' => 'GetSubscription',
'MarketplaceId' => '321',
'NotificationType' => 'foo',
'Destination.DeliveryChannel' => 'SQS',
'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
'Destination.AttributeList.member.1.Value' => 'bar'
@@ -202,27 +121,10 @@
end
def test_deletes_subscription
operation = {
'Action' => 'DeleteSubscription',
- 'MarketplaceId' => '123',
- 'NotificationType' => 'foo',
- 'Destination.DeliveryChannel' => 'SQS',
- 'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
- 'Destination.AttributeList.member.1.Value' => 'bar'
- }
-
- @client.stub(:run, nil) do
- @client.delete_subscription('foo', 'bar')
- end
-
- assert_equal operation, @client.operation
- end
-
- def test_deletes_subscription_with_alternate_marketplace
- operation = {
- 'Action' => 'DeleteSubscription',
'MarketplaceId' => '321',
'NotificationType' => 'foo',
'Destination.DeliveryChannel' => 'SQS',
'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
'Destination.AttributeList.member.1.Value' => 'bar'
@@ -236,23 +138,10 @@
end
def test_lists_subscriptions
operation = {
'Action' => 'ListSubscriptions',
- 'MarketplaceId' => '123'
- }
-
- @client.stub(:run, nil) do
- @client.list_subscriptions
- end
-
- assert_equal operation, @client.operation
- end
-
- def test_lists_subscriptions_with_alternate_marketplace
- operation = {
- 'Action' => 'ListSubscriptions',
'MarketplaceId' => '321'
}
@client.stub(:run, nil) do
@client.list_subscriptions('321')
@@ -260,27 +149,9 @@
assert_equal operation, @client.operation
end
def test_updates_subscription
- operation = {
- 'Action' => 'UpdateSubscription',
- 'MarketplaceId' => '123',
- 'Subscription.IsEnabled' => true,
- 'Subscription.NotificationType' => 'foo',
- 'Subscription.Destination.DeliveryChannel' => 'SQS',
- 'Subscription.Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
- 'Subscription.Destination.AttributeList.member.1.Value' => 'bar'
- }
-
- @client.stub(:run, nil) do
- @client.update_subscription('foo', 'bar', true)
- end
-
- assert_equal operation, @client.operation
- end
-
- def test_updates_subscription_with_alternate_marketplace
operation = {
'Action' => 'UpdateSubscription',
'MarketplaceId' => '321',
'Subscription.IsEnabled' => true,
'Subscription.NotificationType' => 'foo',