def test_dispatch_mismatch_notification_if_errors(self, mock_notify): spreadsheet = baker.make(StateSpreadsheet) process_new_spreadsheet_task(spreadsheet.id) spreadsheet.link_to_matching_spreadsheet_peer.assert_called_once_with() mock_notify.assert_called_once_with(spreadsheet, ["errors"])
def test_import_data_if_spreadsheet_is_ready(self): spreadsheet = baker.make(StateSpreadsheet) process_new_spreadsheet_task(spreadsheet.id) spreadsheet.link_to_matching_spreadsheet_peer.assert_called_once_with() spreadsheet.import_to_final_dataset.assert_called_once_with( notify_import_success)
def test_dispatch_new_spreadsheet_notification_if_nothing_to_compare_with( self, mock_notify): spreadsheet = baker.make(StateSpreadsheet) process_new_spreadsheet_task(spreadsheet.id) spreadsheet.link_to_matching_spreadsheet_peer.assert_called_once_with() mock_notify.assert_called_once_with(spreadsheet) assert not spreadsheet.import_to_final_dataset.called
def test_do_not_process_spreadsheet_if_for_some_reason_it_is_cancelled( self): spreadsheet = baker.make(StateSpreadsheet, cancelled=True) process_new_spreadsheet_task(spreadsheet.pk)