Browse Source

Add some tests for FileSystemBackend and DictBackend.

Jelmer Vernooij 10 years ago
parent
commit
afe20af523
1 changed files with 16 additions and 0 deletions
  1. 16 0
      dulwich/tests/test_server.py

+ 16 - 0
dulwich/tests/test_server.py

@@ -845,6 +845,22 @@ class FileSystemBackendTests(TestCase):
         self.assertRaises(NotGitRepository,
             self.backend.open_repository, os.path.join(self.path, "foo"))
 
+    def test_bad_repo_path(self):
+        backend = FileSystemBackend()
+
+        self.assertRaises(NotGitRepository,
+                          lambda: backend.open_repository('/ups'))
+
+
+class DictBackendTests(TestCase):
+    """Tests for DictBackend."""
+
+    def test_nonexistant(self):
+        repo = MemoryRepo.init_bare([], {})
+        backend = DictBackend({'/': repo})
+        self.assertRaises(NotGitRepository,
+            backend.open_repository, "/does/not/exist/unless/foo")
+
     def test_bad_repo_path(self):
         repo = MemoryRepo.init_bare([], {})
         backend = DictBackend({'/': repo})