test/unit/mws/test_feeds_client.rb in peddler-0.12.4 vs test/unit/mws/test_feeds_client.rb in peddler-0.12.5

- old
+ new

@@ -4,48 +4,95 @@ class TestFeedsClient < MiniTest::Test def setup @client = MWS::Feeds::Client.new end - def test_submit_feed_has_marketplace_id_list + def test_submits_feed + operation = { + 'Action' => 'SubmitFeed', + 'FeedType' => 'type', + 'MarketplaceIdList.Id.1' => '1' + } + @client.stub(:run, nil) do @client.marketplace_id = 'A1F83G8C2ARO7P' @client.submit_feed('content', 'type', marketplace_id_list: '1') - @client.operation.key?('MarketplaceIdList.Id.1') end + + assert_equal operation, @client.operation + assert_equal 'content', @client.body end - def test_get_feed_submission_list_has_feed_submission_id_list + def test_gets_feed_submission_list + operation = { + 'Action' => 'GetFeedSubmissionList', + 'FeedSubmissionIdList.Id.1' => '1', + 'FeedTypeList.Type.1' => '2', + 'FeedProcessingStatusList.Status.1' => '3' + } + @client.stub(:run, nil) do - @client.get_feed_submission_list(feed_submission_id_list: '1') - @client.operation.key?('FeedSubmissionIdList.Status.1') + @client.get_feed_submission_list( + feed_submission_id_list: '1', + feed_type_list: '2', + feed_processing_status_list: '3' + ) end + + assert_equal operation, @client.operation end - def test_get_feed_submission_list_has_feed_type_list + def test_gets_feed_submission_list_by_next_token + operation = { + 'Action' => 'GetFeedSubmissionListByNextToken', + 'NextToken' => '1' + } + @client.stub(:run, nil) do - @client.get_feed_submission_list(feed_type_list: '1') - @client.operation.key?('FeedTypeList.Type.1') + @client.get_feed_submission_list_by_next_token('1') end + + assert_equal operation, @client.operation end - def test_get_feed_submission_list_has_feed_processing_status_list + def test_gets_feed_submission_count + operation = { + 'Action' => 'GetFeedSubmissionCount', + 'FeedTypeList.Type.1' => '1', + 'FeedProcessingStatusList.Status.1' => '2' + } + @client.stub(:run, nil) do - @client.get_feed_submission_list(feed_processing_status_list: '1') - @client.operation.key?('FeedProcessingStatusList.Status.1') + @client.get_feed_submission_count( + feed_type_list: '1', + feed_processing_status_list: '2' + ) end + + assert_equal operation, @client.operation end - def test_get_feed_submission_count_has_feed_type_list + def test_cancels_feed_submissions + operation = { + 'Action' => 'CancelFeedSubmissions' + } + @client.stub(:run, nil) do - @client.get_feed_submission_count(feed_type_list: '1') - @client.operation.key?('FeedTypeList.Type.1') + @client.cancel_feed_submissions end + + assert_equal operation, @client.operation end - def test_get_feed_submission_count_has_feed_processing_status_list + def test_gets_feed_submission_result + operation = { + 'Action' => 'GetFeedSubmissionResult', + 'FeedSubmissionId' => '1' + } + @client.stub(:run, nil) do - @client.get_feed_submission_count(feed_processing_status_list: '1') - @client.operation.key?('FeedProcessingStatusList.Status.1') + @client.get_feed_submission_result('1') end + + assert_equal operation, @client.operation end end