Work with berkeleydb and try importing it first.
This commit is contained in:
1 parent
35416dfc46
commit
5675adeb3c
3 files changed
+7
-2
No files matched your search
@@ -1,4 +1,7 @@
|
||||
try:
|
||||
try:
|
||||
from berkeleydb import db
|
||||
except:
|
||||
from bsddb3 import db
|
||||
class DB(object):
|
||||
def open(self,fname,mode):
|
||||
|
||||
@@ -7,3 +7,4 @@ SMTP-Auth:[email protected] OK
|
||||
SMTP-Auth:example.com REJECT
|
||||
SMTP-Auth:[email protected] REJECT
|
||||
SMTP-Test: REJECT
|
||||
SMTP-Test:.baz.com WILDCARD
|
||||
+3
-2
@@ -8,6 +8,7 @@ class Config(object):
|
||||
def __init__(self):
|
||||
self.access_file='test/access.db'
|
||||
self.access_file_nulls=True
|
||||
self.access_file_colon = False
|
||||
|
||||
class PolicyTestCase(unittest.TestCase):
|
||||
|
||||
@@ -23,8 +24,8 @@ class PolicyTestCase(unittest.TestCase):
|
||||
print("Missing test/access")
|
||||
|
||||
def testPolicy(self):
|
||||
self.config.use_colon = True
|
||||
self.config.use_nulls = True
|
||||
self.config.access_file_colon = False
|
||||
self.config.access_file_nulls = True
|
||||
with MTAPolicy('[email protected]',conf=self.config) as p:
|
||||
pol = p.getPolicy('smtp-auth')
|
||||
self.assertEqual(pol,'OK')
|
||||
|
||||
Reference in new issue
Block a user