You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
912 B

10 years ago
  1. # -*- coding: utf-8 -*-
  2. # © 2015 Agile Business Group <http://www.agilebg.com>
  3. # © 2015 Alessio Gerace <alesiso.gerace@agilebg.com>
  4. # © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
  5. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  6. import os
  7. from datetime import datetime
  8. from openerp.tests import common
  9. class TestsAutoBackup(common.TransactionCase):
  10. def setUp(self):
  11. super(TestsAutoBackup, self).setUp()
  12. self.abk = self.env["db.backup"].create(
  13. {
  14. 'name': u'Têst backup',
  15. }
  16. )
  17. def test_local(self):
  18. """A local database is backed up."""
  19. filename = self.abk.filename(datetime.now())
  20. self.abk.action_backup()
  21. generated_backup = [f for f in os.listdir(self.abk.folder)
  22. if f >= filename]
  23. self.assertEqual(len(generated_backup), 1)