Code

- add latest change to CHANGES.txt changelog
[roundup.git] / test / memorydb.py
index 17c8330f7c3029c86363a3603a04f1a84111e97c..cd830cbd8acee32bbbe307c25cc7c959da535ddd 100644 (file)
@@ -16,17 +16,19 @@ from roundup.backends import indexer_common
 from roundup.hyperdb import *
 from roundup.support import ensureParentsExist
 
-def new_config():
+def new_config(debug=False):
     config = configuration.CoreConfig()
     config.DATABASE = "db"
     #config.logging = MockNull()
     # these TRACKER_WEB and MAIL_DOMAIN values are used in mailgw tests
+    if debug:
+        config.LOGGING_LEVEL = "DEBUG"
     config.MAIL_DOMAIN = "your.tracker.email.domain.example"
     config.TRACKER_WEB = "http://tracker.example/cgi-bin/roundup.cgi/bugs/"
     return config
 
-def create(journaltag, create=True):
-    db = Database(new_config(), journaltag)
+def create(journaltag, create=True, debug=False):
+    db = Database(new_config(debug), journaltag)
 
     # load standard schema
     schema = os.path.join(os.path.dirname(__file__),
@@ -116,6 +118,8 @@ class BasicDatabase(dict):
     def get(self, infoid, value, default=None):
         return self[infoid].get(value, default)
     def getall(self, infoid):
+        if infoid not in self:
+            raise KeyError(infoid)
         return self[infoid]
     def set(self, infoid, **newvalues):
         self[infoid].update(newvalues)