def test_safe_load_tmp(self): from avocado.core import backup from avocado.models import DataField management.call_command('avocado', 'init', 'tests', quiet=True) self.assertEqual(DataField.objects.count(), 18) backup_path = backup.safe_load('0001_avocado_metadata') self.assertTrue(os.path.exists(backup_path)) self.assertEqual(DataField.objects.count(), 3) os.remove(backup_path)
def test_safe_load_tmp(self): from avocado.core import backup from avocado.models import DataField management.call_command('avocado', 'init', 'tests', quiet=True) self.assertEqual(DataField.objects.count(), 12) backup_path = backup.safe_load('0001_avocado_metadata') self.assertTrue(os.path.exists(backup_path)) self.assertEqual(DataField.objects.count(), 3) os.remove(backup_path)
def test_safe_load(self): from avocado.core import backup from avocado.models import DataField management.call_command("avocado", "init", "subcommands") self.assertEqual(DataField.objects.count(), 11) backup_path = backup.safe_load("0001_avocado_metadata", backup_path="backup.json") self.assertTrue(os.path.exists("backup.json")) self.assertEqual(DataField.objects.count(), 3) os.remove(backup_path)
def forwards(self, orm): "Perform a 'safe' load using Avocado's backup utilities." from avocado.core import backup backup.safe_load(u'0002_avocado_metadata', backup_path=None, using='default')