#!/usr/bin/env python
# -*- Mode: Python; indent-tabs-mode: nil; tab-width: 2; coding: utf-8 -*-
#
# This file is part of Déjà Dup.
# © 2008,2009 Michael Terry <mike@mterry.name>
#
# Déjà Dup is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Déjà Dup is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Déjà Dup.  If not, see <http://www.gnu.org/licenses/>.

import sys
import os
sys.path.insert(0, sys.path[0]+'/..')
import base
import ldtp

BASEPATH = '/tmp/deja-dup-test/'
DATE = 'Sat Aug  1 21:14:34 2009'

def test():
  restoredir = base.get_temp_name('restore')
  files = [BASEPATH+'one', BASEPATH+'top/one']
  base.setup('file', dest=(sys.path[0]+'/vols/simple'), encrypt=False, start=False)
  os.system('rm -rf %s' % BASEPATH)
  base.restore_specific(files, restoredir, DATE)
  assert base.file_equals(BASEPATH+'one', 'one1\n')
  assert base.file_equals(BASEPATH+'top/one', 'one\n')
  return True

base.run(test)
