def test_with_exists_collection_run(self): collection_run = CollectionRunFactory.create(legislature=self.legislature) ArchivedExpenseFactory.create(collection_run=collection_run) self.assertEqual(ArchivedExpense.objects.count(), 1) self.base_collector.create_collection_run(self.legislature) self.assertEqual(ArchivedExpense.objects.count(), 0)
def test_with_instituiton_senado(self, mock_institution, mock_call_command, collection_runs_mock): self._create_instituiton('SENADO') collection_run = CollectionRunFactory.create() collection_runs_mock.__iter__.return_value = [collection_run] call_command('collect', 'senado') self.assertIn(call().update_data(), mock_institution.mock_calls) self.assertEqual(mock_call_command.mock_calls, [call('consolidate', 'senado')])
def test_with_instituiton_senado( self, mock_institution, mock_call_command, collection_runs_mock): self._create_instituiton('SENADO') collection_run = CollectionRunFactory.create() collection_runs_mock.__iter__.return_value = [collection_run] call_command('collect', 'senado') self.assertIn(call().update_data(), mock_institution.mock_calls) self.assertEqual( mock_call_command.mock_calls, [call('consolidate', 'senado')] )