summaryrefslogtreecommitdiff
path: root/rdiff-backup/testing
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-02-04 08:40:04 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-02-04 08:40:04 +0000
commit62f19f8a31706a1ae65eeccba4155456e879c7d9 (patch)
tree157ce8c29b890c19fdc7d6f223ecb65fd1df0f51 /rdiff-backup/testing
parent64976e6afefff455ee9515218942a65c6ff5eede (diff)
downloadrdiff-backup-62f19f8a31706a1ae65eeccba4155456e879c7d9.tar.gz
Initial checkin of journal code
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@274 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/testing')
-rw-r--r--rdiff-backup/testing/journaltest.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/rdiff-backup/testing/journaltest.py b/rdiff-backup/testing/journaltest.py
new file mode 100644
index 0000000..76e638a
--- /dev/null
+++ b/rdiff-backup/testing/journaltest.py
@@ -0,0 +1,29 @@
+from commontest import *
+import unittest
+from rdiff_backup import journal, Globals, rpath
+
+class JournalTest(unittest.TestCase):
+ def testBasic(self):
+ """Test opening a journal, then reading, writing, and deleting"""
+ MakeOutputDir()
+ Globals.rbdir = rpath.RPath(Globals.local_connection,
+ "testfiles/output")
+ journal.open_journal()
+ assert len(journal.get_entries_from_journal()) == 0
+
+ # It's important that none of these files really exist
+ e1 = journal.write_entry("Hello48", "reg", "inc_file3917", "t39p")
+ e2 = journal.write_entry("2nd_euoeuo", None, "inc_file4832", "l389")
+ assert e1.entry_rp and e2.entry_rp
+
+ l = journal.get_entries_from_journal()
+ assert len(l) == 2
+ first_filename = l[0].test_filename
+ assert first_filename == "Hello48" or first_filename == "2nd_euoeuo"
+
+ # Now test recovering journal, and make sure everything deleted
+ journal.recover_journal()
+ assert len(journal.get_entries_from_journal()) == 0
+
+
+if __name__ == "__main__": unittest.main()