def test_can_be_cancelled(self): submissions = feeds_gw.submit_product_feed(products=[self.product], marketplaces=[self.marketplace]) submission = submissions[0] self.assertEquals(submission.processing_status, am.STATUS_SUBMITTED) # we need to wait a bit before we can cancel the submission just to # make sure that it is available in the system time.sleep(2) submission = feeds_gw.cancel_submission(submission) # we need to wait again to make sure we get the proper result for the # feed submission ID time.sleep(5) submission = feeds_gw.update_feed_submission(submission) self.assertEquals(submission.processing_status, am.STATUS_CANCELLED)
def test_can_be_cancelled(self): submissions = feeds_gw.submit_product_feed( products=[self.product], marketplaces=[self.marketplace]) submission = submissions[0] self.assertEquals(submission.processing_status, am.STATUS_SUBMITTED) # we need to wait a bit before we can cancel the submission just to # make sure that it is available in the system time.sleep(2) submission = feeds_gw.cancel_submission(submission) # we need to wait again to make sure we get the proper result for the # feed submission ID time.sleep(5) submission = feeds_gw.update_feed_submission(submission) self.assertEquals(submission.processing_status, am.STATUS_CANCELLED)
def test_cancelling_submission_updates_changed_status(submission): response = { 'FeedSubmissionInfo': mock.Mock( FeedSubmissionId=submission.submission_id, SubmittedDate='2012-06-30', FeedType=submission.feed_type, FeedProcessingStatus=STATUS_CANCELLED)} with mock.patch('oscar_mws.feeds.gateway.get_merchant_connection') as conn: conn.return_value = mock.Mock( cancel_feed_submissions=mock.Mock( return_value=mock.Mock(parsed=response))) updated = feed_gw.cancel_submission(submission) assert updated.submission_id == submission.submission_id assert updated.processing_status == STATUS_CANCELLED
def test_cancelling_submission_updates_changed_status(submission): response = { 'FeedSubmissionInfo': mock.Mock(FeedSubmissionId=submission.submission_id, SubmittedDate='2012-06-30', FeedType=submission.feed_type, FeedProcessingStatus=STATUS_CANCELLED) } with mock.patch('oscar_mws.feeds.gateway.get_merchant_connection') as conn: conn.return_value = mock.Mock(cancel_feed_submissions=mock.Mock( return_value=mock.Mock(parsed=response))) updated = feed_gw.cancel_submission(submission) assert updated.submission_id == submission.submission_id assert updated.processing_status == STATUS_CANCELLED
def test_cancelling_submission_without_db_record_creates_it(submission): new_submission = mock.Mock( submission_id='222111333', merchant=submission.merchant, ) response = { 'FeedSubmissionInfo': mock.Mock( FeedSubmissionId=new_submission.submission_id, SubmittedDate='2012-06-30', FeedType=TYPE_POST_PRODUCT_DATA, FeedProcessingStatus=STATUS_CANCELLED)} with mock.patch('oscar_mws.feeds.gateway.get_merchant_connection') as conn: conn.return_value = mock.Mock( cancel_feed_submissions=mock.Mock( return_value=mock.Mock(parsed=response))) updated = feed_gw.cancel_submission(new_submission) assert updated.submission_id == new_submission.submission_id assert updated.processing_status == STATUS_CANCELLED
def test_cancelling_submission_without_db_record_creates_it(submission): new_submission = mock.Mock( submission_id='222111333', merchant=submission.merchant, ) response = { 'FeedSubmissionInfo': mock.Mock(FeedSubmissionId=new_submission.submission_id, SubmittedDate='2012-06-30', FeedType=TYPE_POST_PRODUCT_DATA, FeedProcessingStatus=STATUS_CANCELLED) } with mock.patch('oscar_mws.feeds.gateway.get_merchant_connection') as conn: conn.return_value = mock.Mock(cancel_feed_submissions=mock.Mock( return_value=mock.Mock(parsed=response))) updated = feed_gw.cancel_submission(new_submission) assert updated.submission_id == new_submission.submission_id assert updated.processing_status == STATUS_CANCELLED
def test_can_be_cancelled(self): submissions = feeds_gw.submit_product_feed( products=[self.product], marketplaces=[self.marketplace]) submission = submissions[0] self.assertEquals(submission.processing_status, am.STATUS_SUBMITTED) # we need to wait a bit before we can cancel the submission just to # make sure that it is available in the system time.sleep(2) submission = feeds_gw.cancel_submission(submission) # we need to wait again to make sure we get the proper result for the # feed submission ID time.sleep(INTEGRATION_WAIT_TIME) submission = feeds_gw.update_feed_submission(submission) if submission.processing_status == am.STATUS_IN_PROGRESS: self.fail("submission was cancelled too late, processing was " "already in progress") self.assertEquals(submission.processing_status, am.STATUS_CANCELLED)
def test_can_be_cancelled(self): submissions = feeds_gw.submit_product_feed( products=[self.product], marketplaces=[self.marketplace] ) submission = submissions[0] self.assertEquals(submission.processing_status, am.STATUS_SUBMITTED) # we need to wait a bit before we can cancel the submission just to # make sure that it is available in the system time.sleep(2) submission = feeds_gw.cancel_submission(submission) # we need to wait again to make sure we get the proper result for the # feed submission ID time.sleep(INTEGRATION_WAIT_TIME) submission = feeds_gw.update_feed_submission(submission) if submission.processing_status == am.STATUS_IN_PROGRESS: self.fail("submission was cancelled too late, processing was " "already in progress") self.assertEquals(submission.processing_status, am.STATUS_CANCELLED)