Commit bab08eeb authored by Michael Terry's avatar Michael Terry

tests: add a couple encrypt tests

parent 6998af35
......@@ -179,6 +179,7 @@ class BackupRunner : Object
public OpCallback? callback = null;
public bool is_full = false; // we don't often give INFO 3 which triggers is_full()
public bool is_first = false;
public int passphrases = 0;
public void run()
{
......@@ -203,7 +204,6 @@ class BackupRunner : Object
loop.quit();
});
bool checked_is_full = false;
op.raise_error.connect((str, det) => {
Test.message("Error: %s, %s", str, det);
if (error_str != str)
......@@ -213,25 +213,36 @@ class BackupRunner : Object
error_str = null;
error_detail = null;
});
op.action_desc_changed.connect((action) => {
});
op.action_file_changed.connect((file, actual) => {
});
op.progress.connect((percent) => {
});
op.passphrase_required.connect(() => {
Test.message("Passphrase required");
if (passphrases == 0)
warning("Passphrase needed but not provided");
else {
passphrases--;
op.set_passphrase("test");
}
});
op.question.connect((title, msg) => {
Test.message("Question asked: %s, %s", title, msg);
});
var seen_is_full = false;
op.is_full.connect((first) => {
Test.message("Is full; is first: %d", (int)first);
if (!is_full)
warning("IsFull was not expected");
if (is_first != first)
warning("IsFirst didn't match; expected %d, got %d", (int) is_first, (int) first);
checked_is_full = true;
seen_is_full = true;
});
op.start.begin();
......@@ -243,7 +254,7 @@ class BackupRunner : Object
}
loop.run();
if (!checked_is_full && is_full) {
if (!seen_is_full && is_full) {
warning("IsFull was expected");
if (is_first)
warning("IsFirst was expected");
......@@ -252,6 +263,9 @@ class BackupRunner : Object
warning("Error str didn't match; expected %s, never got error", error_str);
if (error_detail != null)
warning("Error detail didn't match; expected %s, never got error", error_detail);
if (passphrases > 0)
warning("Passphrases expected, but not seen");
}
}
......@@ -323,6 +337,8 @@ void process_operation_block(KeyFile keyfile, string group, BackupRunner br) thr
br.error_str = keyfile.get_string(group, "Error");
if (keyfile.has_key(group, "ErrorDetail"))
br.error_detail = keyfile.get_string(group, "ErrorDetail");
if (keyfile.has_key(group, "Passphrases"))
br.passphrases = keyfile.get_integer(group, "Passphrases");
}
void process_duplicity_run_block(KeyFile keyfile, string run, BackupRunner br) throws Error
......
[Operation]
Type=backup
Passphrases=2
[Duplicity]
Runs=status 1;dry 1;status 2;dry 2;backup 1;status 3;dry 3;backup 2;
[Duplicity status 1]
#DEBUG 1
#. ['duplicity.gpg']
Output=true
[Duplicity dry 1]
#ERROR 31
Output=true
Encrypted=true
[Duplicity status 2]
#DEBUG 1
#. ['duplicity.gpg']
Output=true
Encrypted=true
[Duplicity dry 2]
Encrypted=true
[Duplicity backup 1]
#ERROR 31
Output=true
Encrypted=true
[Duplicity status 3]
#DEBUG 1
#. ['duplicity.gpg']
Output=true
Encrypted=true
[Duplicity dry 3]
Encrypted=true
[Duplicity backup 2]
Encrypted=true
[Operation]
Type=backup
[Duplicity]
Runs=status;dry;backup;
[Duplicity status]
#DEBUG 1
#. ['duplicity.gpg']
Output=true
[Duplicity dry]
Encrypted=true
[Duplicity backup]
Encrypted=true
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