Esempio n. 1
0
def test_backup_directory():
    backup = Backupy(filename_prefix='-backup',
                     filename_format='{date}{prefix}',
                     date_format='%Y.%m.%a')
    current_date = datetime.today().strftime(backup.date_format)

    assert backup.filename == current_date + '-backup'
Esempio n. 2
0
def test_backup():
    backup = Backupy()
    backup.add_directory('./')
    backup.start()

    assert os.path.exists(backup.filename)
    os.remove(backup.filename)
from Backupy import Backupy

backup = Backupy()
backup.add_directory(
    directory='/var/www/html/assets/',
    exclude={'images', 'fonts/images', '*/sass/*m*.sass', 'logs/log.txt'})
backup.start()
Esempio n. 4
0
def test_backup_directory():
    backup = Backupy()
    backup2 = Backupy(backup_directory='/var/')

    assert backup.backup_dir == os.getcwd()
    assert backup2.backup_dir == '/var/'
from Backupy import Backupy

"""
By default filename format is backup_13-02-2020
prefix: backup_
filename format: {prefix}{date}
date format: %d-%m-%Y
"""

backup = Backupy(
    filename_prefix='-backup',  # change filename prefix
    filename_format='{date}{prefix}',  # change filename format
    date_format='%Y-%m-%a'  # change date format
)
backup.add_directory('/var/www/html/assets/')
backup.start()  # Output file will be: 2020-02-Thu-backup
Esempio n. 6
0
from Backupy import Backupy

"""
Backup directory is the directory where backups will be saved
By default, it is current working directory
"""

backup = Backupy(backup_directory='/home/backup/')
backup.add_directory('/var/www/html/assets/')
backup.start()
Esempio n. 7
0
from Backupy import Backupy
"""
:param databases is optional:
1) You can specify the databases for backup by listing them with a space
2) Or leave it blank to backup all databases
"""

backup = Backupy()
backup.add_database_credentials(host='DB_HOST',
                                user='******',
                                password='******',
                                databases='database1 database2 database3')
backup.add_database_credentials(host='DB_HOST',
                                user='******',
                                password='******')
backup.start()
Esempio n. 8
0
from Backupy import Backupy

backup = Backupy(backup_directory='/home/backup/')
backup.add_directory('/var/www/html/assets/')
backup.add_directory('/etc/apache2/')
backup.add_database_credentials(host='DB_HOST',
                                user='******',
                                password='******')
backup.start()
Esempio n. 9
0
def test_backup_directory():
    backup = Backupy()
    assert backup.dirs == ()

    backup.add_directory('/test/')
    assert backup.dirs == ('/test/', )