peddler 0.12.5 → 0.12.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +7 -5
- data/lib/mws/fulfillment_inbound_shipment/client.rb +1 -0
- data/lib/mws/subscriptions/client.rb +1 -1
- data/lib/peddler/client.rb +2 -2
- data/lib/peddler/flat_file_response.rb +53 -0
- data/lib/peddler/operation.rb +4 -4
- data/lib/peddler/response.rb +24 -0
- data/lib/peddler/version.rb +1 -1
- data/lib/peddler/xml_response.rb +30 -0
- data/test/helper.rb +74 -0
- data/test/integration/test_cart_information.rb +1 -1
- data/test/integration/test_customer_information.rb +1 -1
- data/test/integration/test_feeds.rb +1 -1
- data/test/integration/test_fulfillment_inbound_shipment.rb +1 -1
- data/test/integration/test_fulfillment_inventory.rb +1 -1
- data/test/integration/test_fulfillment_outbound_shipment.rb +1 -1
- data/test/integration/test_off_amazon_payments.rb +1 -1
- data/test/integration/test_orders.rb +1 -1
- data/test/integration/test_products.rb +1 -1
- data/test/integration/test_recommendations.rb +1 -1
- data/test/integration/test_reports.rb +1 -1
- data/test/integration/test_sellers.rb +1 -1
- data/test/integration/test_subscriptions.rb +1 -1
- data/test/integration/test_webstore.rb +1 -1
- data/test/unit/mws/test_cart_information_client.rb +2 -2
- data/test/unit/mws/test_customer_information_client.rb +2 -2
- data/test/unit/mws/test_feeds_client.rb +2 -2
- data/test/unit/mws/test_fulfillment_inbound_shipment_client.rb +12 -4
- data/test/unit/mws/test_fulfillment_inventory_client.rb +2 -2
- data/test/unit/mws/test_fulfillment_outbound_shipment_client.rb +2 -2
- data/test/unit/mws/test_off_amazon_payments_client.rb +1 -1
- data/test/unit/mws/test_orders_client.rb +2 -2
- data/test/unit/mws/test_products_client.rb +156 -7
- data/test/unit/mws/test_recommendations_client.rb +2 -2
- data/test/unit/mws/test_reports_client.rb +187 -4
- data/test/unit/mws/test_sellers_client.rb +2 -2
- data/test/unit/mws/test_subscriptions_client.rb +291 -4
- data/test/unit/mws/test_webstore_client.rb +83 -4
- data/test/unit/peddler/test_client.rb +1 -1
- data/test/unit/peddler/test_flat_file_parser.rb +1 -1
- data/test/unit/peddler/test_marketplace.rb +1 -1
- data/test/unit/peddler/test_operation.rb +8 -1
- data/test/unit/peddler/test_parser.rb +1 -1
- data/test/unit/peddler/test_structured_list.rb +1 -1
- data/test/unit/peddler/test_xml_parser.rb +1 -1
- data/test/unit/test_mws.rb +2 -2
- metadata +7 -6
- data/test/integration_test_helper.rb +0 -48
- data/test/test_helper.rb +0 -7
@@ -1,11 +1,196 @@
|
|
1
|
-
require '
|
1
|
+
require 'helper'
|
2
2
|
require 'mws/reports/client'
|
3
3
|
|
4
|
-
class
|
4
|
+
class TestMWSReportsClient < MiniTest::Test
|
5
5
|
def setup
|
6
6
|
@client = MWS::Reports::Client.new
|
7
7
|
end
|
8
8
|
|
9
|
+
def test_requests_report
|
10
|
+
operation = {
|
11
|
+
'Action' => 'RequestReport',
|
12
|
+
'ReportType' => 'foo',
|
13
|
+
'MarketplaceIdList.Id.1' => '1'
|
14
|
+
}
|
15
|
+
|
16
|
+
@client.stub(:run, nil) do
|
17
|
+
@client.request_report('foo', marketplace_id_list: ['1'])
|
18
|
+
end
|
19
|
+
|
20
|
+
assert_equal operation, @client.operation
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_gets_report_request_list
|
24
|
+
operation = {
|
25
|
+
'Action' => 'GetReportRequestList',
|
26
|
+
'ReportRequestIdList.Id.1' => '1',
|
27
|
+
'ReportTypeList.Type.1' => '2',
|
28
|
+
'ReportProcessingStatusList.Status.1' => '3'
|
29
|
+
}
|
30
|
+
|
31
|
+
@client.stub(:run, nil) do
|
32
|
+
@client.get_report_request_list(
|
33
|
+
report_request_id_list: '1',
|
34
|
+
report_type_list: '2',
|
35
|
+
report_processing_status_list: '3'
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
assert_equal operation, @client.operation
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_gets_report_request_list_by_next_token
|
43
|
+
operation = {
|
44
|
+
'Action' => 'GetReportRequestListByNextToken',
|
45
|
+
'NextToken' => '1'
|
46
|
+
}
|
47
|
+
|
48
|
+
@client.stub(:run, nil) do
|
49
|
+
@client.get_report_request_list_by_next_token('1')
|
50
|
+
end
|
51
|
+
|
52
|
+
assert_equal operation, @client.operation
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_gets_report_request_count
|
56
|
+
operation = {
|
57
|
+
'Action' => 'GetReportRequestCount',
|
58
|
+
'ReportTypeList.Type.1' => '1',
|
59
|
+
'ReportProcessingStatusList.Status.1' => '2'
|
60
|
+
}
|
61
|
+
|
62
|
+
@client.stub(:run, nil) do
|
63
|
+
@client.get_report_request_count(
|
64
|
+
report_type_list: '1',
|
65
|
+
report_processing_status_list: '2'
|
66
|
+
)
|
67
|
+
end
|
68
|
+
|
69
|
+
assert_equal operation, @client.operation
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_cancels_report_requests
|
73
|
+
operation = {
|
74
|
+
'Action' => 'CancelReportRequests',
|
75
|
+
'ReportTypeList.Type.1' => '1',
|
76
|
+
'ReportProcessingStatusList.Status.1' => '2'
|
77
|
+
}
|
78
|
+
|
79
|
+
@client.stub(:run, nil) do
|
80
|
+
@client.cancel_report_requests(
|
81
|
+
report_type_list: '1',
|
82
|
+
report_processing_status_list: '2'
|
83
|
+
)
|
84
|
+
end
|
85
|
+
|
86
|
+
assert_equal operation, @client.operation
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_gets_report_list
|
90
|
+
operation = {
|
91
|
+
'Action' => 'GetReportList',
|
92
|
+
'ReportTypeList.Type.1' => '1',
|
93
|
+
'ReportRequestIdList.Id.1' => '2'
|
94
|
+
}
|
95
|
+
|
96
|
+
@client.stub(:run, nil) do
|
97
|
+
@client.get_report_list(
|
98
|
+
report_type_list: '1',
|
99
|
+
report_request_id_list: '2'
|
100
|
+
)
|
101
|
+
end
|
102
|
+
|
103
|
+
assert_equal operation, @client.operation
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_gets_report_list_by_next_token
|
107
|
+
operation = {
|
108
|
+
'Action' => 'GetReportListByNextToken',
|
109
|
+
'NextToken' => '1'
|
110
|
+
}
|
111
|
+
|
112
|
+
@client.stub(:run, nil) do
|
113
|
+
@client.get_report_list_by_next_token('1')
|
114
|
+
end
|
115
|
+
|
116
|
+
assert_equal operation, @client.operation
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_gets_report_count
|
120
|
+
operation = {
|
121
|
+
'Action' => 'GetReportCount',
|
122
|
+
'ReportTypeList.Type.1' => '1'
|
123
|
+
}
|
124
|
+
|
125
|
+
@client.stub(:run, nil) do
|
126
|
+
@client.get_report_count(
|
127
|
+
report_type_list: '1'
|
128
|
+
)
|
129
|
+
end
|
130
|
+
|
131
|
+
assert_equal operation, @client.operation
|
132
|
+
end
|
133
|
+
|
134
|
+
def test_gets_report
|
135
|
+
operation = {
|
136
|
+
'Action' => 'GetReport',
|
137
|
+
'ReportId' => '1'
|
138
|
+
}
|
139
|
+
|
140
|
+
@client.stub(:run, nil) do
|
141
|
+
@client.get_report('1')
|
142
|
+
end
|
143
|
+
|
144
|
+
assert_equal operation, @client.operation
|
145
|
+
end
|
146
|
+
|
147
|
+
def test_manages_report_schedule
|
148
|
+
operation = {
|
149
|
+
'Action' => 'ManageReportSchedule',
|
150
|
+
'ReportType' => '1',
|
151
|
+
'Schedule' => '2'
|
152
|
+
}
|
153
|
+
|
154
|
+
@client.stub(:run, nil) do
|
155
|
+
@client.manage_report_schedule('1', '2')
|
156
|
+
end
|
157
|
+
|
158
|
+
assert_equal operation, @client.operation
|
159
|
+
end
|
160
|
+
|
161
|
+
def test_gets_report_schedule_list
|
162
|
+
operation = {
|
163
|
+
'Action' => 'GetReportScheduleList',
|
164
|
+
'ReportTypeList.Type.1' => '1',
|
165
|
+
'ReportTypeList.Type.2' => '2'
|
166
|
+
}
|
167
|
+
|
168
|
+
@client.stub(:run, nil) do
|
169
|
+
@client.get_report_schedule_list('1', '2')
|
170
|
+
end
|
171
|
+
|
172
|
+
assert_equal operation, @client.operation
|
173
|
+
end
|
174
|
+
|
175
|
+
def test_gets_report_schedule_list_by_next_token
|
176
|
+
assert_raises(NotImplementedError) do
|
177
|
+
@client.get_report_schedule_list_by_next_token
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
def test_gets_report_schedule_count
|
182
|
+
operation = {
|
183
|
+
'Action' => 'GetReportScheduleCount',
|
184
|
+
'ReportTypeList.Type.1' => '1'
|
185
|
+
}
|
186
|
+
|
187
|
+
@client.stub(:run, nil) do
|
188
|
+
@client.get_report_schedule_count('1')
|
189
|
+
end
|
190
|
+
|
191
|
+
assert_equal operation, @client.operation
|
192
|
+
end
|
193
|
+
|
9
194
|
def test_updates_report_acknowledgements
|
10
195
|
operation = {
|
11
196
|
'Action' => 'UpdateReportAcknowledgements',
|
@@ -19,6 +204,4 @@ class TestReportsClient < MiniTest::Test
|
|
19
204
|
|
20
205
|
assert_equal operation, @client.operation
|
21
206
|
end
|
22
|
-
|
23
|
-
# FIXME Fill in tests for operations
|
24
207
|
end
|
@@ -1,9 +1,298 @@
|
|
1
|
-
require '
|
1
|
+
require 'helper'
|
2
2
|
require 'mws/subscriptions/client'
|
3
3
|
|
4
|
-
class
|
4
|
+
class TestMWSSubscriptionsClient < MiniTest::Test
|
5
5
|
def setup
|
6
6
|
@client = MWS::Subscriptions::Client.new
|
7
|
+
@client.marketplace_id = '123'
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_registers_destination
|
11
|
+
operation = {
|
12
|
+
'Action' => 'RegisterDestination',
|
13
|
+
'MarketplaceId' => '123',
|
14
|
+
'Destination.DeliveryChannel' => 'SQS',
|
15
|
+
'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
16
|
+
'Destination.AttributeList.member.1.Value' => 'foo'
|
17
|
+
}
|
18
|
+
|
19
|
+
@client.stub(:run, nil) do
|
20
|
+
@client.register_destination('foo')
|
21
|
+
end
|
22
|
+
|
23
|
+
assert_equal operation, @client.operation
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_registers_destination_with_alternate_marketplace
|
27
|
+
operation = {
|
28
|
+
'Action' => 'RegisterDestination',
|
29
|
+
'MarketplaceId' => '321',
|
30
|
+
'Destination.DeliveryChannel' => 'SQS',
|
31
|
+
'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
32
|
+
'Destination.AttributeList.member.1.Value' => 'foo'
|
33
|
+
}
|
34
|
+
|
35
|
+
@client.stub(:run, nil) do
|
36
|
+
@client.register_destination('foo', '321')
|
37
|
+
end
|
38
|
+
|
39
|
+
assert_equal operation, @client.operation
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_deregisters_destination
|
43
|
+
operation = {
|
44
|
+
'Action' => 'DeregisterDestination',
|
45
|
+
'MarketplaceId' => '123',
|
46
|
+
'Destination.DeliveryChannel' => 'SQS',
|
47
|
+
'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
48
|
+
'Destination.AttributeList.member.1.Value' => 'foo'
|
49
|
+
}
|
50
|
+
|
51
|
+
@client.stub(:run, nil) do
|
52
|
+
@client.deregister_destination('foo')
|
53
|
+
end
|
54
|
+
|
55
|
+
assert_equal operation, @client.operation
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_deregisters_destination_with_alternate_marketplace
|
59
|
+
operation = {
|
60
|
+
'Action' => 'DeregisterDestination',
|
61
|
+
'MarketplaceId' => '321',
|
62
|
+
'Destination.DeliveryChannel' => 'SQS',
|
63
|
+
'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
64
|
+
'Destination.AttributeList.member.1.Value' => 'foo'
|
65
|
+
}
|
66
|
+
|
67
|
+
@client.stub(:run, nil) do
|
68
|
+
@client.deregister_destination('foo', '321')
|
69
|
+
end
|
70
|
+
|
71
|
+
assert_equal operation, @client.operation
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_lists_registered_destinations
|
75
|
+
operation = {
|
76
|
+
'Action' => 'ListRegisteredDestinations',
|
77
|
+
'MarketplaceId' => '123'
|
78
|
+
}
|
79
|
+
|
80
|
+
@client.stub(:run, nil) do
|
81
|
+
@client.list_registered_destinations
|
82
|
+
end
|
83
|
+
|
84
|
+
assert_equal operation, @client.operation
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_lists_registered_destinations_with_alternate_marketplace
|
88
|
+
operation = {
|
89
|
+
'Action' => 'ListRegisteredDestinations',
|
90
|
+
'MarketplaceId' => '321'
|
91
|
+
}
|
92
|
+
|
93
|
+
@client.stub(:run, nil) do
|
94
|
+
@client.list_registered_destinations('321')
|
95
|
+
end
|
96
|
+
|
97
|
+
assert_equal operation, @client.operation
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_sends_test_notification_to_destination
|
101
|
+
operation = {
|
102
|
+
'Action' => 'SendTestNotificationToDestination',
|
103
|
+
'MarketplaceId' => '123',
|
104
|
+
'Destination.DeliveryChannel' => 'SQS',
|
105
|
+
'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
106
|
+
'Destination.AttributeList.member.1.Value' => 'foo'
|
107
|
+
}
|
108
|
+
|
109
|
+
@client.stub(:run, nil) do
|
110
|
+
@client.send_test_notification_to_destination('foo')
|
111
|
+
end
|
112
|
+
|
113
|
+
assert_equal operation, @client.operation
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_send_test_notification_to_destination_with_alternate_marketplace
|
117
|
+
operation = {
|
118
|
+
'Action' => 'SendTestNotificationToDestination',
|
119
|
+
'MarketplaceId' => '321',
|
120
|
+
'Destination.DeliveryChannel' => 'SQS',
|
121
|
+
'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
122
|
+
'Destination.AttributeList.member.1.Value' => 'foo'
|
123
|
+
}
|
124
|
+
|
125
|
+
@client.stub(:run, nil) do
|
126
|
+
@client.send_test_notification_to_destination('foo', '321')
|
127
|
+
end
|
128
|
+
|
129
|
+
assert_equal operation, @client.operation
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_creates_subscription
|
133
|
+
operation = {
|
134
|
+
'Action' => 'CreateSubscription',
|
135
|
+
'MarketplaceId' => '123',
|
136
|
+
'Subscription.IsEnabled'=>true,
|
137
|
+
'Subscription.NotificationType' => 'foo',
|
138
|
+
'Subscription.Destination.DeliveryChannel' => 'SQS',
|
139
|
+
'Subscription.Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
140
|
+
'Subscription.Destination.AttributeList.member.1.Value' => 'bar'
|
141
|
+
}
|
142
|
+
|
143
|
+
@client.stub(:run, nil) do
|
144
|
+
@client.create_subscription('foo', 'bar')
|
145
|
+
end
|
146
|
+
|
147
|
+
assert_equal operation, @client.operation
|
148
|
+
end
|
149
|
+
|
150
|
+
def test_creates_subscription_with_alternate_marketplace
|
151
|
+
operation = {
|
152
|
+
'Action' => 'CreateSubscription',
|
153
|
+
'MarketplaceId' => '321',
|
154
|
+
'Subscription.IsEnabled'=>true,
|
155
|
+
'Subscription.NotificationType' => 'foo',
|
156
|
+
'Subscription.Destination.DeliveryChannel' => 'SQS',
|
157
|
+
'Subscription.Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
158
|
+
'Subscription.Destination.AttributeList.member.1.Value' => 'bar'
|
159
|
+
}
|
160
|
+
|
161
|
+
@client.stub(:run, nil) do
|
162
|
+
@client.create_subscription('foo', 'bar', '321')
|
163
|
+
end
|
164
|
+
|
165
|
+
assert_equal operation, @client.operation
|
166
|
+
end
|
167
|
+
|
168
|
+
def test_gets_subscription
|
169
|
+
operation = {
|
170
|
+
'Action' => 'GetSubscription',
|
171
|
+
'MarketplaceId' => '123',
|
172
|
+
'NotificationType' => 'foo',
|
173
|
+
'Destination.DeliveryChannel' => 'SQS',
|
174
|
+
'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
175
|
+
'Destination.AttributeList.member.1.Value' => 'bar'
|
176
|
+
}
|
177
|
+
|
178
|
+
@client.stub(:run, nil) do
|
179
|
+
@client.get_subscription('foo', 'bar')
|
180
|
+
end
|
181
|
+
|
182
|
+
assert_equal operation, @client.operation
|
183
|
+
end
|
184
|
+
|
185
|
+
def test_gets_subscription_with_alternate_marketplace
|
186
|
+
operation = {
|
187
|
+
'Action' => 'GetSubscription',
|
188
|
+
'MarketplaceId' => '321',
|
189
|
+
'NotificationType' => 'foo',
|
190
|
+
'Destination.DeliveryChannel' => 'SQS',
|
191
|
+
'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
192
|
+
'Destination.AttributeList.member.1.Value' => 'bar'
|
193
|
+
}
|
194
|
+
|
195
|
+
@client.stub(:run, nil) do
|
196
|
+
@client.get_subscription('foo', 'bar', '321')
|
197
|
+
end
|
198
|
+
|
199
|
+
assert_equal operation, @client.operation
|
200
|
+
end
|
201
|
+
|
202
|
+
def test_deletes_subscription
|
203
|
+
operation = {
|
204
|
+
'Action' => 'DeleteSubscription',
|
205
|
+
'MarketplaceId' => '123',
|
206
|
+
'NotificationType' => 'foo',
|
207
|
+
'Destination.DeliveryChannel' => 'SQS',
|
208
|
+
'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
209
|
+
'Destination.AttributeList.member.1.Value' => 'bar'
|
210
|
+
}
|
211
|
+
|
212
|
+
@client.stub(:run, nil) do
|
213
|
+
@client.delete_subscription('foo', 'bar')
|
214
|
+
end
|
215
|
+
|
216
|
+
assert_equal operation, @client.operation
|
217
|
+
end
|
218
|
+
|
219
|
+
def test_deletes_subscription_with_alternate_marketplace
|
220
|
+
operation = {
|
221
|
+
'Action' => 'DeleteSubscription',
|
222
|
+
'MarketplaceId' => '321',
|
223
|
+
'NotificationType' => 'foo',
|
224
|
+
'Destination.DeliveryChannel' => 'SQS',
|
225
|
+
'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
226
|
+
'Destination.AttributeList.member.1.Value' => 'bar'
|
227
|
+
}
|
228
|
+
|
229
|
+
@client.stub(:run, nil) do
|
230
|
+
@client.delete_subscription('foo', 'bar', '321')
|
231
|
+
end
|
232
|
+
|
233
|
+
assert_equal operation, @client.operation
|
234
|
+
end
|
235
|
+
|
236
|
+
def test_lists_subscriptions
|
237
|
+
operation = {
|
238
|
+
'Action' => 'ListSubscriptions',
|
239
|
+
'MarketplaceId' => '123'
|
240
|
+
}
|
241
|
+
|
242
|
+
@client.stub(:run, nil) do
|
243
|
+
@client.list_subscriptions
|
244
|
+
end
|
245
|
+
|
246
|
+
assert_equal operation, @client.operation
|
247
|
+
end
|
248
|
+
|
249
|
+
def test_lists_subscriptions_with_alternate_marketplace
|
250
|
+
operation = {
|
251
|
+
'Action' => 'ListSubscriptions',
|
252
|
+
'MarketplaceId' => '321'
|
253
|
+
}
|
254
|
+
|
255
|
+
@client.stub(:run, nil) do
|
256
|
+
@client.list_subscriptions('321')
|
257
|
+
end
|
258
|
+
|
259
|
+
assert_equal operation, @client.operation
|
260
|
+
end
|
261
|
+
|
262
|
+
def test_updates_subscription
|
263
|
+
operation = {
|
264
|
+
'Action' => 'UpdateSubscription',
|
265
|
+
'MarketplaceId' => '123',
|
266
|
+
'Subscription.IsEnabled' => true,
|
267
|
+
'Subscription.NotificationType' => 'foo',
|
268
|
+
'Subscription.Destination.DeliveryChannel' => 'SQS',
|
269
|
+
'Subscription.Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
270
|
+
'Subscription.Destination.AttributeList.member.1.Value' => 'bar'
|
271
|
+
}
|
272
|
+
|
273
|
+
@client.stub(:run, nil) do
|
274
|
+
@client.update_subscription('foo', 'bar', true)
|
275
|
+
end
|
276
|
+
|
277
|
+
assert_equal operation, @client.operation
|
278
|
+
end
|
279
|
+
|
280
|
+
def test_updates_subscription_with_alternate_marketplace
|
281
|
+
operation = {
|
282
|
+
'Action' => 'UpdateSubscription',
|
283
|
+
'MarketplaceId' => '321',
|
284
|
+
'Subscription.IsEnabled' => true,
|
285
|
+
'Subscription.NotificationType' => 'foo',
|
286
|
+
'Subscription.Destination.DeliveryChannel' => 'SQS',
|
287
|
+
'Subscription.Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
|
288
|
+
'Subscription.Destination.AttributeList.member.1.Value' => 'bar'
|
289
|
+
}
|
290
|
+
|
291
|
+
@client.stub(:run, nil) do
|
292
|
+
@client.update_subscription('foo', 'bar', true, '321')
|
293
|
+
end
|
294
|
+
|
295
|
+
assert_equal operation, @client.operation
|
7
296
|
end
|
8
297
|
|
9
298
|
def test_gets_service_status
|
@@ -17,6 +306,4 @@ class TestSubscriptionsClient < MiniTest::Test
|
|
17
306
|
|
18
307
|
assert_equal operation, @client.operation
|
19
308
|
end
|
20
|
-
|
21
|
-
# FIXME Fill in tests for operations
|
22
309
|
end
|
@@ -1,11 +1,92 @@
|
|
1
|
-
require '
|
1
|
+
require 'helper'
|
2
2
|
require 'mws/webstore/client'
|
3
3
|
|
4
|
-
class
|
4
|
+
class TestMWSWebstoreClient < MiniTest::Test
|
5
5
|
def setup
|
6
6
|
@client = MWS::Webstore::Client.new
|
7
7
|
end
|
8
8
|
|
9
|
+
def test_lists_subscriptions_count
|
10
|
+
@client.marketplace_id = '123'
|
11
|
+
operation = {
|
12
|
+
'Action' => 'ListSubscriptionsCount',
|
13
|
+
'MarketplaceId' => '123',
|
14
|
+
'SubscriptionState' => '1',
|
15
|
+
'SellerSKUList.SellerSKU.1' => '1'
|
16
|
+
}
|
17
|
+
|
18
|
+
@client.stub(:run, nil) do
|
19
|
+
@client.list_subscriptions_count('1', seller_sku_list: ['1'])
|
20
|
+
end
|
21
|
+
|
22
|
+
assert_equal operation, @client.operation
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_lists_subscriptions_count_with_alternate_marketplace
|
26
|
+
operation = {
|
27
|
+
'Action' => 'ListSubscriptionsCount',
|
28
|
+
'MarketplaceId' => '321',
|
29
|
+
'SubscriptionState' => '1',
|
30
|
+
'SellerSKUList.SellerSKU.1' => '1'
|
31
|
+
}
|
32
|
+
|
33
|
+
@client.stub(:run, nil) do
|
34
|
+
@client.list_subscriptions_count(
|
35
|
+
'1',
|
36
|
+
seller_sku_list: ['1'],
|
37
|
+
marketplace_id: '321'
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
assert_equal operation, @client.operation
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_lists_subscriptions_count_by_next_token
|
45
|
+
operation = {
|
46
|
+
'Action' => 'ListSubscriptionsCountByNextToken',
|
47
|
+
'NextToken' => '1'
|
48
|
+
}
|
49
|
+
|
50
|
+
@client.stub(:run, nil) do
|
51
|
+
@client.list_subscriptions_count_by_next_token('1')
|
52
|
+
end
|
53
|
+
|
54
|
+
assert_equal operation, @client.operation
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_get_subscriptions_details
|
58
|
+
@client.marketplace_id = '123'
|
59
|
+
operation = {
|
60
|
+
'Action' => 'GetSubscriptionDetails',
|
61
|
+
'MarketplaceId' => '123',
|
62
|
+
'SellerSKU' => '1',
|
63
|
+
'SubscriptionState' => '2',
|
64
|
+
'DateRangeStart' => '3'
|
65
|
+
}
|
66
|
+
|
67
|
+
@client.stub(:run, nil) do
|
68
|
+
@client.get_subscription_details('1', '2', '3')
|
69
|
+
end
|
70
|
+
|
71
|
+
assert_equal operation, @client.operation
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_get_subscriptions_details_with_alternate_marketplace
|
75
|
+
operation = {
|
76
|
+
'Action' => 'GetSubscriptionDetails',
|
77
|
+
'MarketplaceId' => '321',
|
78
|
+
'SellerSKU' => '1',
|
79
|
+
'SubscriptionState' => '2',
|
80
|
+
'DateRangeStart' => '3'
|
81
|
+
}
|
82
|
+
|
83
|
+
@client.stub(:run, nil) do
|
84
|
+
@client.get_subscription_details('1', '2', '3', marketplace_id: '321')
|
85
|
+
end
|
86
|
+
|
87
|
+
assert_equal operation, @client.operation
|
88
|
+
end
|
89
|
+
|
9
90
|
def test_gets_service_status
|
10
91
|
operation = {
|
11
92
|
'Action' => 'GetServiceStatus'
|
@@ -17,6 +98,4 @@ class TestWebstoreClient < MiniTest::Test
|
|
17
98
|
|
18
99
|
assert_equal operation, @client.operation
|
19
100
|
end
|
20
|
-
|
21
|
-
# FIXME Fill in tests for operations
|
22
101
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'helper'
|
2
2
|
require 'peddler/operation'
|
3
3
|
|
4
4
|
class TestPeddlerOperation < MiniTest::Test
|
@@ -14,6 +14,13 @@ class TestPeddlerOperation < MiniTest::Test
|
|
14
14
|
assert_equal 2, @operation['FooStatus.Foo.2']
|
15
15
|
end
|
16
16
|
|
17
|
+
def test_converts_nested_key_to_structured_list
|
18
|
+
@operation.store('Foo.Status', [1])
|
19
|
+
@operation.structure!('Status', 'Bar')
|
20
|
+
refute @operation.has_key?('FooStatus')
|
21
|
+
assert_equal 1, @operation['Foo.Status.Bar.1']
|
22
|
+
end
|
23
|
+
|
17
24
|
def test_store_camelizes_key
|
18
25
|
@operation.store(:foo_bar, 'baz')
|
19
26
|
assert @operation.has_key?('FooBar')
|