3e7777d0654e

Add some sample data for sandboxing.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sun, 04 Oct 2009 15:40:29 -0400
parents 896d4023c274
children a11953bf5d2f
branches/tags (none)
files review/tests/__init__.py review/tests/sample_data.py review/tests/test_init.py

Changes

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/review/tests/sample_data.py	Sun Oct 04 15:40:29 2009 -0400
@@ -0,0 +1,8 @@
+log = [
+    { 'file_one': 'hello\nworld',
+      'file_two': 'this is another test file',
+    },
+    { 'file_one': 'hello again\nworld'},
+      'file_three': 'this is a new file\nfor testing',
+    },
+]
\ No newline at end of file
--- a/review/tests/test_init.py	Sun Oct 04 15:32:39 2009 -0400
+++ b/review/tests/test_init.py	Sun Oct 04 15:40:29 2009 -0400
@@ -1,6 +1,7 @@
 from nose import *
 from mercurial import commands, hg, ui
 import os, shutil
+import sample_data
 
 
 sandbox_path = os.path.join(os.path.realpath('.'), 'hgreview_test')
@@ -10,10 +11,18 @@
     os.chdir(sandbox_path)
     
     commands.init(ui.ui())
+    sandbox = get_sandbox_repo()
+    
+    opts = {'addremove': True, 'date': None, 'user': 'Review Tester', 'logfile': None}
+    for state in sample_data.log:
+        for filename in state:
+            with open(filename, 'w') as f:
+                f.write(state[filename])
+        commands.commit(ui.ui(), sandbox, message="Sandbox commit.")
 
 def teardown_sandbox():
     os.chdir(os.path.realpath(os.path.join(sandbox_path, os.pardir)))
-    shutil.rmtree(sandbox_path)
+    # shutil.rmtree(sandbox_path)
 
 def get_sandbox_repo():
     return hg.repository(ui.ui(), '.')