import os.path
import unittest

import test_base
from BackupItemFile import *

class BackupItemFileTest(unittest.TestCase):
	
	def testAddFilesToTarArchive(self):
		# checks we can backup something trivial without problems:
		backupDirPath = test_base.tmpDirPath
		infileName = "to_backup_1.txt"
		fileName = "backup_item_file_test"
		files = [test_base.getInFilePath(infileName)]
		outFilePath = os.path.join(backupDirPath, fileName + ".tgz")
		bb = BackupItemFile(backupDirPath, fileName, files)
		bb.doBackup()
		
		# check the file exists (will get exception if it doesn't)
		ff = open(outFilePath, "r")
		ff.close()
