Commit 6ee0a1ff authored by Michael Terry's avatar Michael Terry

tests: various updates to work with new codebase

parent 0492ea36
......@@ -72,7 +72,7 @@ def writing():
f = open(restorefile, 'rb')
string = f.read()
f.close()
assert re.match('^%c+$' % string[0], string), string[0:1024]
assert re.match('^%c+$' % string[0], string), string
def pause_before():
global last_written
......
......@@ -28,6 +28,7 @@ import ldtp
import glob
import re
import traceback
import time
srcdir = "."
temp_dir = None
......@@ -369,7 +370,7 @@ def wait_for_encryption(dlg, encrypt):
ldtp.click(dlg, 'rbtnAllowrestoringwithoutapassword')
ldtp.click(dlg, 'btnContinue')
break
ldtp.wait(1)
time.sleep(1)
count += 1
assert count < max_count, max_count
......
......@@ -25,31 +25,33 @@ import subprocess
# First we test how things work with defaults, never used
def defaults():
base.setup()
assert base.get_settings_value('folder', schema="S3") == "''", base.get_settings_value('folder', schema="S3")
base.setup()
assert base.get_settings_value('folder', schema="S3") == "''", base.get_settings_value('folder', schema="S3")
# Now test when there has been a run
def has_run():
base.setup()
base.set_settings_value('last-run', "'foo'")
base.start_deja_dup(executable='deja-dup-preferences')
pout = subprocess.Popen('hostname', stdout=subprocess.PIPE).communicate()[0].strip()
assert base.get_settings_value('folder', schema="S3") == "'%s'" % pout, base.get_settings_value('folder', schema="S3")
base.setup()
base.set_settings_value('last-run', "'foo'")
base.start_deja_dup(executable='deja-dup-preferences')
pout = subprocess.Popen('hostname', stdout=subprocess.PIPE).communicate()[0].strip()
assert base.get_settings_value('folder', schema="S3") == "'%s'" % pout, base.get_settings_value('folder', schema="S3")
# Now test when backend isn't s3
def is_not_s3():
base.setup()
base.set_settings_value('backend', "'rackspace'")
base.start_deja_dup(executable='deja-dup-preferences')
pout = subprocess.Popen('hostname', stdout=subprocess.PIPE).communicate()[0].strip()
assert base.get_settings_value('folder', schema="S3") == "'%s'" % pout, base.get_settings_value('folder', schema="S3")
base.setup()
base.set_settings_value('backend', "'rackspace'")
base.start_deja_dup(executable='deja-dup-preferences')
ldtp.click('frmBackup', 'btnJustshowmybackupsettings')
pout = subprocess.Popen('hostname', stdout=subprocess.PIPE).communicate()[0].strip()
assert base.get_settings_value('folder', schema="S3") == "'%s'" % pout, base.get_settings_value('folder', schema="S3")
# Now test when folder isn't '/'
def custom_folder():
base.setup()
base.set_settings_value('folder', "'foo'", schema="S3")
base.start_deja_dup(executable='deja-dup-preferences')
assert base.get_settings_value('folder', schema="S3") == "'foo'", base.get_settings_value('folder', schema="S3")
base.setup()
base.set_settings_value('folder', "'foo'", schema="S3")
base.start_deja_dup(executable='deja-dup-preferences')
ldtp.click('frmBackup', 'btnJustshowmybackupsettings')
assert base.get_settings_value('folder', schema="S3") == "'foo'", base.get_settings_value('folder', schema="S3")
base.run(defaults)
base.run(has_run)
......
......@@ -19,16 +19,16 @@
import sys
import os
import datetime
import subprocess
import stat
sys.path.insert(0, sys.path[0]+'/..')
import base
import ldtp
BASEPATH = '/tmp/deja-dup-test/'
DATE1 = datetime.datetime.strptime('8 1 21:14:21 2009', '%m %d %H:%M:%S %Y').strftime('%x %X')
DATE2 = datetime.datetime.strptime('8 1 21:14:34 2009', '%m %d %H:%M:%S %Y').strftime('%x %X')
DATE3 = datetime.datetime.strptime('8 1 21:14:41 2009', '%m %d %H:%M:%S %Y').strftime('%x %X')
DATE1 = subprocess.Popen(['date', '-d', '2009-08-01 21:14:21', '+%x %X'], stdout=subprocess.PIPE).communicate()[0].strip()
DATE2 = subprocess.Popen(['date', '-d', '2009-08-01 21:14:34', '+%x %X'], stdout=subprocess.PIPE).communicate()[0].strip()
DATE3 = subprocess.Popen(['date', '-d', '2009-08-01 21:14:41', '+%x %X'], stdout=subprocess.PIPE).communicate()[0].strip()
def check_dir(path, oneval):
root = path+BASEPATH
......
......@@ -19,12 +19,13 @@
import sys
import os
import subprocess
sys.path.insert(0, sys.path[0]+'/..')
import base
import ldtp
BASEPATH = '/tmp/deja-dup-test/'
DATE = '08/01/09 21:14:34'
DATE = subprocess.Popen(['date', '-d', '08/01/09 21:14:34', '+%x %X'], stdout=subprocess.PIPE).communicate()[0].strip()
def test():
restoredir = base.get_temp_name('restore')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment