peddler 2.0.4 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -18
- data/lib/mws/fulfillment_inbound_shipment/client.rb +18 -0
- data/lib/mws/fulfillment_outbound_shipment/client.rb +0 -11
- data/lib/mws/reports/parser.rb +35 -0
- data/lib/peddler/errors/builder.rb +2 -1
- data/lib/peddler/errors/class_generator.rb +1 -0
- data/lib/peddler/flat_file_parser.rb +1 -0
- data/lib/peddler/headers.rb +4 -0
- data/lib/peddler/marketplace.rb +1 -0
- data/lib/peddler/operation.rb +12 -2
- data/lib/peddler/version.rb +1 -1
- data/lib/peddler/xml_parser.rb +1 -0
- data/lib/peddler/xml_response_parser.rb +1 -1
- data/test/helper.rb +1 -0
- data/test/integration/test_feeds.rb +3 -3
- data/test/integration/test_fulfillment_inbound_shipment.rb +3 -3
- data/test/integration/test_fulfillment_inventory.rb +2 -2
- data/test/integration/test_fulfillment_outbound_shipment.rb +1 -1
- data/test/integration/test_merchant_fulfillment.rb +57 -1
- data/test/integration/test_multibyte_queries.rb +1 -1
- data/test/integration/test_mws_headers.rb +1 -1
- data/test/integration/test_off_amazon_payments.rb +1 -1
- data/test/integration/test_orders.rb +2 -2
- data/test/integration/test_products.rb +12 -12
- data/test/integration/test_recommendations.rb +2 -2
- data/test/integration/test_reports.rb +6 -6
- data/test/integration/test_sellers.rb +1 -1
- data/test/integration/test_subscriptions.rb +3 -3
- data/test/integration_helper.rb +9 -7
- data/test/unit/mws/test_feeds_client.rb +6 -6
- data/test/unit/mws/test_finances_client.rb +5 -5
- data/test/unit/mws/test_fulfillment_inbound_shipment_client.rb +40 -24
- data/test/unit/mws/test_fulfillment_inventory_client.rb +3 -3
- data/test/unit/mws/test_fulfillment_outbound_shipment_client.rb +11 -11
- data/test/unit/mws/test_merchant_fulfillment_client.rb +5 -5
- data/test/unit/mws/test_off_amazon_payments_client.rb +17 -17
- data/test/unit/mws/test_orders_client.rb +7 -7
- data/test/unit/mws/test_products_client.rb +15 -15
- data/test/unit/mws/test_recommendations_client.rb +4 -4
- data/test/unit/mws/test_reports_client.rb +14 -14
- data/test/unit/mws/test_sellers_client.rb +3 -3
- data/test/unit/mws/test_subscriptions_client.rb +11 -11
- data/test/unit/peddler/errors/test_builder.rb +4 -4
- data/test/unit/peddler/errors/test_class_generator.rb +1 -1
- data/test/unit/peddler/errors/test_error.rb +5 -5
- data/test/unit/peddler/errors/test_parser.rb +4 -4
- data/test/unit/peddler/test_client.rb +20 -20
- data/test/unit/peddler/test_flat_file_parser.rb +11 -11
- data/test/unit/peddler/test_headers.rb +1 -1
- data/test/unit/peddler/test_marketplace.rb +1 -1
- data/test/unit/peddler/test_operation.rb +18 -12
- data/test/unit/peddler/test_parser.rb +3 -3
- data/test/unit/peddler/test_structured_list.rb +5 -5
- data/test/unit/peddler/test_vcr_matcher.rb +4 -4
- data/test/unit/peddler/test_xml_parser.rb +3 -3
- data/test/unit/peddler/test_xml_response_parser.rb +4 -4
- data/test/unit/test_mws.rb +1 -1
- data/test/vcr_cassettes/FulfillmentInboundShipment.yml +36 -36
- data/test/vcr_cassettes/MerchantFulfillment.yml +309 -1
- metadata +3 -2
@@ -8,7 +8,7 @@ class TestMWSRecommendationsClient < MiniTest::Test
|
|
8
8
|
@client = MWS::Recommendations::Client.new
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
11
|
+
def test_getting_last_updated_time_for_recommendations
|
12
12
|
operation = {
|
13
13
|
'Action' => 'GetLastUpdatedTimeForRecommendations',
|
14
14
|
'MarketplaceId' => '1'
|
@@ -21,7 +21,7 @@ class TestMWSRecommendationsClient < MiniTest::Test
|
|
21
21
|
assert_equal operation, @client.operation
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
24
|
+
def test_listing_recommendations
|
25
25
|
operation = {
|
26
26
|
'Action' => 'ListRecommendations',
|
27
27
|
'CategoryQueryList.CategoryQuery.1.FilterOptions.FilterOption.1.Foo' => '1',
|
@@ -35,7 +35,7 @@ class TestMWSRecommendationsClient < MiniTest::Test
|
|
35
35
|
assert_equal operation, @client.operation
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
38
|
+
def test_listing_recommendations_by_next_token
|
39
39
|
operation = {
|
40
40
|
'Action' => 'ListRecommendationsByNextToken',
|
41
41
|
'NextToken' => '1'
|
@@ -48,7 +48,7 @@ class TestMWSRecommendationsClient < MiniTest::Test
|
|
48
48
|
assert_equal operation, @client.operation
|
49
49
|
end
|
50
50
|
|
51
|
-
def
|
51
|
+
def test_getting_service_status
|
52
52
|
operation = {
|
53
53
|
'Action' => 'GetServiceStatus'
|
54
54
|
}
|
@@ -8,7 +8,7 @@ class TestMWSReportsClient < MiniTest::Test
|
|
8
8
|
@client = MWS::Reports::Client.new
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
11
|
+
def test_requesting_report
|
12
12
|
operation = {
|
13
13
|
'Action' => 'RequestReport',
|
14
14
|
'ReportType' => 'foo',
|
@@ -22,7 +22,7 @@ class TestMWSReportsClient < MiniTest::Test
|
|
22
22
|
assert_equal operation, @client.operation
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
25
|
+
def test_getting_report_request_list
|
26
26
|
operation = {
|
27
27
|
'Action' => 'GetReportRequestList',
|
28
28
|
'ReportRequestIdList.Id.1' => '1',
|
@@ -41,7 +41,7 @@ class TestMWSReportsClient < MiniTest::Test
|
|
41
41
|
assert_equal operation, @client.operation
|
42
42
|
end
|
43
43
|
|
44
|
-
def
|
44
|
+
def test_getting_report_request_list_by_next_token
|
45
45
|
operation = {
|
46
46
|
'Action' => 'GetReportRequestListByNextToken',
|
47
47
|
'NextToken' => '1'
|
@@ -54,7 +54,7 @@ class TestMWSReportsClient < MiniTest::Test
|
|
54
54
|
assert_equal operation, @client.operation
|
55
55
|
end
|
56
56
|
|
57
|
-
def
|
57
|
+
def test_getting_report_request_count
|
58
58
|
operation = {
|
59
59
|
'Action' => 'GetReportRequestCount',
|
60
60
|
'ReportTypeList.Type.1' => '1',
|
@@ -71,7 +71,7 @@ class TestMWSReportsClient < MiniTest::Test
|
|
71
71
|
assert_equal operation, @client.operation
|
72
72
|
end
|
73
73
|
|
74
|
-
def
|
74
|
+
def test_canceling_report_requests
|
75
75
|
operation = {
|
76
76
|
'Action' => 'CancelReportRequests',
|
77
77
|
'ReportTypeList.Type.1' => '1',
|
@@ -88,7 +88,7 @@ class TestMWSReportsClient < MiniTest::Test
|
|
88
88
|
assert_equal operation, @client.operation
|
89
89
|
end
|
90
90
|
|
91
|
-
def
|
91
|
+
def test_getting_report_list
|
92
92
|
operation = {
|
93
93
|
'Action' => 'GetReportList',
|
94
94
|
'ReportTypeList.Type.1' => '1',
|
@@ -105,7 +105,7 @@ class TestMWSReportsClient < MiniTest::Test
|
|
105
105
|
assert_equal operation, @client.operation
|
106
106
|
end
|
107
107
|
|
108
|
-
def
|
108
|
+
def test_getting_report_list_by_next_token
|
109
109
|
operation = {
|
110
110
|
'Action' => 'GetReportListByNextToken',
|
111
111
|
'NextToken' => '1'
|
@@ -118,7 +118,7 @@ class TestMWSReportsClient < MiniTest::Test
|
|
118
118
|
assert_equal operation, @client.operation
|
119
119
|
end
|
120
120
|
|
121
|
-
def
|
121
|
+
def test_getting_report_count
|
122
122
|
operation = {
|
123
123
|
'Action' => 'GetReportCount',
|
124
124
|
'ReportTypeList.Type.1' => '1'
|
@@ -133,7 +133,7 @@ class TestMWSReportsClient < MiniTest::Test
|
|
133
133
|
assert_equal operation, @client.operation
|
134
134
|
end
|
135
135
|
|
136
|
-
def
|
136
|
+
def test_getting_report
|
137
137
|
operation = {
|
138
138
|
'Action' => 'GetReport',
|
139
139
|
'ReportId' => '1'
|
@@ -146,7 +146,7 @@ class TestMWSReportsClient < MiniTest::Test
|
|
146
146
|
assert_equal operation, @client.operation
|
147
147
|
end
|
148
148
|
|
149
|
-
def
|
149
|
+
def test_managing_report_schedule
|
150
150
|
operation = {
|
151
151
|
'Action' => 'ManageReportSchedule',
|
152
152
|
'ReportType' => '1',
|
@@ -160,7 +160,7 @@ class TestMWSReportsClient < MiniTest::Test
|
|
160
160
|
assert_equal operation, @client.operation
|
161
161
|
end
|
162
162
|
|
163
|
-
def
|
163
|
+
def test_getting_report_schedule_list
|
164
164
|
operation = {
|
165
165
|
'Action' => 'GetReportScheduleList',
|
166
166
|
'ReportTypeList.Type.1' => '1',
|
@@ -174,13 +174,13 @@ class TestMWSReportsClient < MiniTest::Test
|
|
174
174
|
assert_equal operation, @client.operation
|
175
175
|
end
|
176
176
|
|
177
|
-
def
|
177
|
+
def test_getting_report_schedule_list_by_next_token
|
178
178
|
assert_raises NotImplementedError do
|
179
179
|
@client.get_report_schedule_list_by_next_token
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
183
|
-
def
|
183
|
+
def test_getting_report_schedule_count
|
184
184
|
operation = {
|
185
185
|
'Action' => 'GetReportScheduleCount',
|
186
186
|
'ReportTypeList.Type.1' => '1'
|
@@ -193,7 +193,7 @@ class TestMWSReportsClient < MiniTest::Test
|
|
193
193
|
assert_equal operation, @client.operation
|
194
194
|
end
|
195
195
|
|
196
|
-
def
|
196
|
+
def test_updating_report_acknowledgements
|
197
197
|
operation = {
|
198
198
|
'Action' => 'UpdateReportAcknowledgements',
|
199
199
|
'Acknowledged' => true,
|
@@ -8,7 +8,7 @@ class TestMWSSellersClient < MiniTest::Test
|
|
8
8
|
@client = MWS::Sellers::Client.new
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
11
|
+
def test_listing_marketplace_participations
|
12
12
|
operation = {
|
13
13
|
'Action' => 'ListMarketplaceParticipations'
|
14
14
|
}
|
@@ -20,7 +20,7 @@ class TestMWSSellersClient < MiniTest::Test
|
|
20
20
|
assert_equal operation, @client.operation
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
23
|
+
def test_listing_marketplace_participations_by_next_token
|
24
24
|
operation = {
|
25
25
|
'Action' => 'ListMarketplaceParticipationsByNextToken',
|
26
26
|
'NextToken' => '1'
|
@@ -33,7 +33,7 @@ class TestMWSSellersClient < MiniTest::Test
|
|
33
33
|
assert_equal operation, @client.operation
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
36
|
+
def test_getting_service_status
|
37
37
|
operation = {
|
38
38
|
'Action' => 'GetServiceStatus'
|
39
39
|
}
|
@@ -8,7 +8,7 @@ class TestMWSSubscriptionsClient < MiniTest::Test
|
|
8
8
|
@client = MWS::Subscriptions::Client.new
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
11
|
+
def test_registering_destination
|
12
12
|
operation = {
|
13
13
|
'Action' => 'RegisterDestination',
|
14
14
|
'MarketplaceId' => '321',
|
@@ -24,7 +24,7 @@ class TestMWSSubscriptionsClient < MiniTest::Test
|
|
24
24
|
assert_equal operation, @client.operation
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
27
|
+
def test_deregistering_destination
|
28
28
|
operation = {
|
29
29
|
'Action' => 'DeregisterDestination',
|
30
30
|
'MarketplaceId' => '123',
|
@@ -40,7 +40,7 @@ class TestMWSSubscriptionsClient < MiniTest::Test
|
|
40
40
|
assert_equal operation, @client.operation
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
43
|
+
def test_deregistering_destination_with_alternate_marketplace
|
44
44
|
operation = {
|
45
45
|
'Action' => 'DeregisterDestination',
|
46
46
|
'MarketplaceId' => '321',
|
@@ -56,7 +56,7 @@ class TestMWSSubscriptionsClient < MiniTest::Test
|
|
56
56
|
assert_equal operation, @client.operation
|
57
57
|
end
|
58
58
|
|
59
|
-
def
|
59
|
+
def test_listing_registered_destinations
|
60
60
|
operation = {
|
61
61
|
'Action' => 'ListRegisteredDestinations',
|
62
62
|
'MarketplaceId' => '321'
|
@@ -69,7 +69,7 @@ class TestMWSSubscriptionsClient < MiniTest::Test
|
|
69
69
|
assert_equal operation, @client.operation
|
70
70
|
end
|
71
71
|
|
72
|
-
def
|
72
|
+
def test_sending_test_notification_to_destination
|
73
73
|
operation = {
|
74
74
|
'Action' => 'SendTestNotificationToDestination',
|
75
75
|
'MarketplaceId' => '321',
|
@@ -85,7 +85,7 @@ class TestMWSSubscriptionsClient < MiniTest::Test
|
|
85
85
|
assert_equal operation, @client.operation
|
86
86
|
end
|
87
87
|
|
88
|
-
def
|
88
|
+
def test_creating_subscription
|
89
89
|
operation = {
|
90
90
|
'Action' => 'CreateSubscription',
|
91
91
|
'MarketplaceId' => '321',
|
@@ -103,7 +103,7 @@ class TestMWSSubscriptionsClient < MiniTest::Test
|
|
103
103
|
assert_equal operation, @client.operation
|
104
104
|
end
|
105
105
|
|
106
|
-
def
|
106
|
+
def test_getting_subscription
|
107
107
|
operation = {
|
108
108
|
'Action' => 'GetSubscription',
|
109
109
|
'MarketplaceId' => '321',
|
@@ -120,7 +120,7 @@ class TestMWSSubscriptionsClient < MiniTest::Test
|
|
120
120
|
assert_equal operation, @client.operation
|
121
121
|
end
|
122
122
|
|
123
|
-
def
|
123
|
+
def test_deleting_subscription
|
124
124
|
operation = {
|
125
125
|
'Action' => 'DeleteSubscription',
|
126
126
|
'MarketplaceId' => '321',
|
@@ -137,7 +137,7 @@ class TestMWSSubscriptionsClient < MiniTest::Test
|
|
137
137
|
assert_equal operation, @client.operation
|
138
138
|
end
|
139
139
|
|
140
|
-
def
|
140
|
+
def test_listing_subscriptions
|
141
141
|
operation = {
|
142
142
|
'Action' => 'ListSubscriptions',
|
143
143
|
'MarketplaceId' => '321'
|
@@ -150,7 +150,7 @@ class TestMWSSubscriptionsClient < MiniTest::Test
|
|
150
150
|
assert_equal operation, @client.operation
|
151
151
|
end
|
152
152
|
|
153
|
-
def
|
153
|
+
def test_updating_subscription
|
154
154
|
operation = {
|
155
155
|
'Action' => 'UpdateSubscription',
|
156
156
|
'MarketplaceId' => '321',
|
@@ -168,7 +168,7 @@ class TestMWSSubscriptionsClient < MiniTest::Test
|
|
168
168
|
assert_equal operation, @client.operation
|
169
169
|
end
|
170
170
|
|
171
|
-
def
|
171
|
+
def test_getting_service_status
|
172
172
|
operation = {
|
173
173
|
'Action' => 'GetServiceStatus'
|
174
174
|
}
|
@@ -28,15 +28,15 @@ class TestPeddlerErrorsBuilder < MiniTest::Test
|
|
28
28
|
super
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
31
|
+
def test_custom_error
|
32
32
|
assert_includes @error.class.name, @code
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
35
|
+
def test_message
|
36
36
|
assert_equal @message, @error.message
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
39
|
+
def test_cause
|
40
40
|
assert_equal @cause, @error.cause
|
41
41
|
end
|
42
42
|
end
|
@@ -58,7 +58,7 @@ class TestPeddlerErrorsBuilder < MiniTest::Test
|
|
58
58
|
super
|
59
59
|
end
|
60
60
|
|
61
|
-
def
|
61
|
+
def test_that_it_returns_nothing
|
62
62
|
assert_nil @error
|
63
63
|
end
|
64
64
|
end
|
@@ -9,25 +9,25 @@ class TestPeddlerErrorsError < MiniTest::Test
|
|
9
9
|
@error = Peddler::Errors::Error.new('message', @cause)
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
12
|
+
def test_message
|
13
13
|
assert_equal 'message', @error.message
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
16
|
+
def test_cause
|
17
17
|
assert_equal @cause, @error.cause
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
20
|
+
def test_that_it_defines_common_errors
|
21
21
|
Peddler::Errors::CODES.each do |name|
|
22
22
|
assert ::Peddler::Errors.const_defined?(name)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
26
|
+
def test_that_it_allows_nil_arguments
|
27
27
|
Peddler::Errors::Error.new
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
30
|
+
def test_that_it_delegates_response_to_cause
|
31
31
|
assert_equal @cause.response, @error.response
|
32
32
|
end
|
33
33
|
end
|
@@ -26,19 +26,19 @@ class TestPeddlerErrorsParser < MiniTest::Test
|
|
26
26
|
@parser = Peddler::Errors::Parser.new(res)
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
29
|
+
def test_parsing_data
|
30
30
|
assert @parser.parse
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
33
|
+
def test_message
|
34
34
|
assert @parser.message
|
35
35
|
end
|
36
36
|
|
37
|
-
def
|
37
|
+
def test_code
|
38
38
|
assert @parser.code
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
41
|
+
def test_type
|
42
42
|
assert @parser.type
|
43
43
|
end
|
44
44
|
end
|
@@ -24,27 +24,27 @@ class TestPeddlerClient < MiniTest::Test
|
|
24
24
|
super
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
27
|
+
def test_user_agent
|
28
28
|
assert @client.connection.data[:headers].key?('User-Agent')
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
31
|
+
def test_inheritance_of_parents_params
|
32
32
|
assert_equal Peddler::Client.params, @klass.params
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
35
|
+
def test_that_params_include_seller_id
|
36
36
|
assert @klass.params.key?('SellerId')
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
39
|
+
def test_that_params_include_auth_token
|
40
40
|
@klass.params.key?('MWSAuthToken')
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
43
|
+
def test_inheritance_of_parents_parser
|
44
44
|
assert_equal @klass.parser, Class.new(@klass).parser
|
45
45
|
end
|
46
46
|
|
47
|
-
def
|
47
|
+
def test_setting_marketplace
|
48
48
|
marketplace = Peddler::Marketplace.find('US')
|
49
49
|
@client.marketplace = 'US'
|
50
50
|
assert_equal marketplace, @client.marketplace
|
@@ -52,19 +52,19 @@ class TestPeddlerClient < MiniTest::Test
|
|
52
52
|
assert_equal marketplace, @client.marketplace
|
53
53
|
end
|
54
54
|
|
55
|
-
def
|
55
|
+
def test_configuring_when_initialising
|
56
56
|
client = @klass.new(aws_access_key_id: '123')
|
57
57
|
assert_equal '123', client.aws_access_key_id
|
58
58
|
end
|
59
59
|
|
60
|
-
def
|
60
|
+
def test_setting_content_type_header_for_latin_flat_file
|
61
61
|
@client.body = 'foo'
|
62
62
|
content_type = @client.headers.fetch('Content-Type')
|
63
63
|
|
64
64
|
assert_equal 'text/tab-separated-values; charset=CP1252', content_type
|
65
65
|
end
|
66
66
|
|
67
|
-
def
|
67
|
+
def test_setting_content_type_header_for_chinese_flat_file
|
68
68
|
@client.marketplace = 'CN'
|
69
69
|
@client.body = 'foo'
|
70
70
|
content_type = @client.headers.fetch('Content-Type')
|
@@ -72,7 +72,7 @@ class TestPeddlerClient < MiniTest::Test
|
|
72
72
|
assert_equal 'text/tab-separated-values; charset=UTF-16', content_type
|
73
73
|
end
|
74
74
|
|
75
|
-
def
|
75
|
+
def test_setting_content_type_header_for_japanese_flat_file
|
76
76
|
@client.marketplace = 'JP'
|
77
77
|
@client.body = 'foo'
|
78
78
|
content_type = @client.headers.fetch('Content-Type')
|
@@ -80,42 +80,42 @@ class TestPeddlerClient < MiniTest::Test
|
|
80
80
|
assert_equal 'text/tab-separated-values; charset=Windows-31J', content_type
|
81
81
|
end
|
82
82
|
|
83
|
-
def
|
83
|
+
def test_setting_content_type_header_for_xml
|
84
84
|
@client.body = '<?xml version="1.0"?><Foo></Foo>'
|
85
85
|
content_type = @client.headers.fetch('Content-Type')
|
86
86
|
|
87
87
|
assert_equal 'text/xml', content_type
|
88
88
|
end
|
89
89
|
|
90
|
-
def
|
90
|
+
def test_encoding_body_for_latin_flat_file
|
91
91
|
@client.body = 'foo'
|
92
92
|
assert_equal 'Windows-1252', @client.body.encoding.to_s
|
93
93
|
end
|
94
94
|
|
95
|
-
def
|
95
|
+
def test_encoding_body_for_chinese_flat_file
|
96
96
|
@client.marketplace = 'CN'
|
97
97
|
@client.body = 'foo'
|
98
98
|
assert_equal 'UTF-16', @client.body.encoding.to_s
|
99
99
|
end
|
100
100
|
|
101
|
-
def
|
101
|
+
def test_encoding_body_for_japanese_flat_file
|
102
102
|
@client.marketplace = 'JP'
|
103
103
|
@client.body = 'foo'
|
104
104
|
assert_equal 'Windows-31J', @client.body.encoding.to_s
|
105
105
|
end
|
106
106
|
|
107
|
-
def
|
107
|
+
def test_running_a_request
|
108
108
|
res = @client.run
|
109
109
|
assert_equal @response_body, res.body
|
110
110
|
end
|
111
111
|
|
112
|
-
def
|
112
|
+
def test_clearing_body_when_run_succeeds
|
113
113
|
@client.body = 'foo'
|
114
114
|
@client.run
|
115
115
|
assert_nil @client.body
|
116
116
|
end
|
117
117
|
|
118
|
-
def
|
118
|
+
def test_streaming_response
|
119
119
|
chunks = ''
|
120
120
|
streamer = ->(chunk, _, _) { chunks += chunk }
|
121
121
|
@client.run(&streamer)
|
@@ -136,7 +136,7 @@ class TestPeddlerClient < MiniTest::Test
|
|
136
136
|
@events = {}
|
137
137
|
end
|
138
138
|
|
139
|
-
def
|
139
|
+
def test_that_request_preserves_user_agent
|
140
140
|
@client.defaults.update(instrumentor: Instrumentor)
|
141
141
|
@client.run
|
142
142
|
headers = Instrumentor.events['excon.request'][:headers]
|
@@ -164,7 +164,7 @@ class TestPeddlerClient < MiniTest::Test
|
|
164
164
|
end
|
165
165
|
end
|
166
166
|
|
167
|
-
def
|
167
|
+
def test_it_does_not_clear_body_when_run_fails
|
168
168
|
@client.body = 'foo'
|
169
169
|
assert_raises Peddler::Errors::RequestThrottled do
|
170
170
|
@client.run
|
@@ -192,7 +192,7 @@ class TestPeddlerClient < MiniTest::Test
|
|
192
192
|
end
|
193
193
|
end
|
194
194
|
|
195
|
-
def
|
195
|
+
def test_it_does_not_clear_body_when_run_fails
|
196
196
|
@client.body = 'foo'
|
197
197
|
assert_raises Excon::Error::InternalServerError do
|
198
198
|
@client.run
|