예제 #1
0
def test_create_backup_obj():
    setup()

    exec_path = os.getcwd()
    try:
        mbt.Backup(exec_path)
        assert True  # Build correctly.
    except Exception:
        assert False  # Error while creating backup object.
예제 #2
0
def test_execute_backup():
    setup()

    exec_path = os.getcwd()
    b = mbt.Backup(exec_path, backup_paths=['resources/t1'], out_path='out')
    b.backup()

    name = 'bck_{}'.format(b._start_datetime.strftime('%Y%m%d-%H%M%S'))

    assert isfile(join('out', name + '.tar.gz'))
    assert isfile(join('out', name + '.log.txt'))
예제 #3
0
def test_execute_backup_outname():
    setup()

    exec_path = os.getcwd()
    b = mbt.Backup(exec_path,
                   backup_paths=['resources/t1'],
                   out_path='out',
                   out_name='unconventional_name')
    b.backup()

    name = 'unconventional_name'

    assert isfile(join('out', name + '.tar.gz'))
    assert isfile(join('out', name + '.log.txt'))