Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
77f6f71f
Commit
77f6f71f
authored
Apr 08, 2010
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coverage for App.ApplicationManager.AltDatabaseManager.
parent
1644a7be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
38 deletions
+53
-38
src/App/tests/test_ApplicationManager.py
src/App/tests/test_ApplicationManager.py
+53
-38
No files found.
src/App/tests/test_ApplicationManager.py
View file @
77f6f71f
...
@@ -245,7 +245,49 @@ class DebugManagerTests(unittest.TestCase):
...
@@ -245,7 +245,49 @@ class DebugManagerTests(unittest.TestCase):
self
.
assertEqual
(
dm
.
manage_getSysPath
(),
list
(
sys
.
path
))
self
.
assertEqual
(
dm
.
manage_getSysPath
(),
list
(
sys
.
path
))
class
ApplicationManagerTests
(
ConfigTestBase
,
unittest
.
TestCase
):
class
DBProxyTestsBase
:
def
_makeOne
(
self
):
return
self
.
_getTargetClass
()()
def
_makeJar
(
self
,
dbname
,
dbsize
):
class
Jar
:
def
db
(
self
):
return
self
.
_db
jar
=
Jar
()
jar
.
_db
=
DummyDB
(
dbname
,
dbsize
)
return
jar
def
test_db_name
(
self
):
am
=
self
.
_makeOne
()
am
.
_p_jar
=
self
.
_makeJar
(
'foo'
,
''
)
self
.
assertEqual
(
am
.
db_name
(),
'foo'
)
def
test_db_size_string
(
self
):
am
=
self
.
_makeOne
()
am
.
_p_jar
=
self
.
_makeJar
(
'foo'
,
'super'
)
self
.
assertEqual
(
am
.
db_size
(),
'super'
)
def
test_db_size_lt_1_meg
(
self
):
am
=
self
.
_makeOne
()
am
.
_p_jar
=
self
.
_makeJar
(
'foo'
,
4497
)
self
.
assertEqual
(
am
.
db_size
(),
'4.4K'
)
def
test_db_size_gt_1_meg
(
self
):
am
=
self
.
_makeOne
()
am
.
_p_jar
=
self
.
_makeJar
(
'foo'
,
(
2048
*
1024
)
+
123240
)
self
.
assertEqual
(
am
.
db_size
(),
'2.1M'
)
def
test_manage_pack
(
self
):
am
=
self
.
_makeOne
()
jar
=
am
.
_p_jar
=
self
.
_makeJar
(
'foo'
,
''
)
am
.
manage_pack
(
1
,
_when
=
86400
*
2
)
self
.
assertEqual
(
jar
.
_db
.
_packed
,
86400
)
class
ApplicationManagerTests
(
ConfigTestBase
,
DBProxyTestsBase
,
unittest
.
TestCase
,
):
def
setUp
(
self
):
def
setUp
(
self
):
ConfigTestBase
.
setUp
(
self
)
ConfigTestBase
.
setUp
(
self
)
...
@@ -261,17 +303,6 @@ class ApplicationManagerTests(ConfigTestBase, unittest.TestCase):
...
@@ -261,17 +303,6 @@ class ApplicationManagerTests(ConfigTestBase, unittest.TestCase):
from
App.ApplicationManager
import
ApplicationManager
from
App.ApplicationManager
import
ApplicationManager
return
ApplicationManager
return
ApplicationManager
def
_makeOne
(
self
):
return
self
.
_getTargetClass
()()
def
_makeJar
(
self
,
dbname
,
dbsize
):
class
Jar
:
def
db
(
self
):
return
self
.
_db
jar
=
Jar
()
jar
.
_db
=
DummyDB
(
dbname
,
dbsize
)
return
jar
def
_makeTempdir
(
self
):
def
_makeTempdir
(
self
):
import
tempfile
import
tempfile
tmp
=
tempfile
.
mkdtemp
()
tmp
=
tempfile
.
mkdtemp
()
...
@@ -357,35 +388,9 @@ class ApplicationManagerTests(ConfigTestBase, unittest.TestCase):
...
@@ -357,35 +388,9 @@ class ApplicationManagerTests(ConfigTestBase, unittest.TestCase):
am
=
self
.
_makeOne
()
am
=
self
.
_makeOne
()
self
.
assertEqual
(
am
.
thread_get_ident
(),
thread
.
get_ident
())
self
.
assertEqual
(
am
.
thread_get_ident
(),
thread
.
get_ident
())
def
test_db_name
(
self
):
am
=
self
.
_makeOne
()
am
.
_p_jar
=
self
.
_makeJar
(
'foo'
,
''
)
self
.
assertEqual
(
am
.
db_name
(),
'foo'
)
def
test_db_size_string
(
self
):
am
=
self
.
_makeOne
()
am
.
_p_jar
=
self
.
_makeJar
(
'foo'
,
'super'
)
self
.
assertEqual
(
am
.
db_size
(),
'super'
)
def
test_db_size_lt_1_meg
(
self
):
am
=
self
.
_makeOne
()
am
.
_p_jar
=
self
.
_makeJar
(
'foo'
,
4497
)
self
.
assertEqual
(
am
.
db_size
(),
'4.4K'
)
def
test_db_size_gt_1_meg
(
self
):
am
=
self
.
_makeOne
()
am
.
_p_jar
=
self
.
_makeJar
(
'foo'
,
(
2048
*
1024
)
+
123240
)
self
.
assertEqual
(
am
.
db_size
(),
'2.1M'
)
#def test_manage_restart(self): XXX -- TOO UGLY TO TEST
#def test_manage_restart(self): XXX -- TOO UGLY TO TEST
#def test_manage_restart(self): XXX -- TOO UGLY TO TEST
#def test_manage_restart(self): XXX -- TOO UGLY TO TEST
def
test_manage_pack
(
self
):
am
=
self
.
_makeOne
()
jar
=
am
.
_p_jar
=
self
.
_makeJar
(
'foo'
,
''
)
am
.
manage_pack
(
1
,
_when
=
86400
*
2
)
self
.
assertEqual
(
jar
.
_db
.
_packed
,
86400
)
def
test_revert_points
(
self
):
def
test_revert_points
(
self
):
am
=
self
.
_makeOne
()
am
=
self
.
_makeOne
()
self
.
assertEqual
(
list
(
am
.
revert_points
()),
[])
self
.
assertEqual
(
list
(
am
.
revert_points
()),
[])
...
@@ -464,6 +469,15 @@ class ApplicationManagerTests(ConfigTestBase, unittest.TestCase):
...
@@ -464,6 +469,15 @@ class ApplicationManagerTests(ConfigTestBase, unittest.TestCase):
#def test_objectIds(self): XXX -- TOO UGLY TO TEST (BBB for Zope 2.3!!)
#def test_objectIds(self): XXX -- TOO UGLY TO TEST (BBB for Zope 2.3!!)
class
AltDatabaseManagerTests
(
DBProxyTestsBase
,
unittest
.
TestCase
,
):
def
_getTargetClass
(
self
):
from
App.ApplicationManager
import
AltDatabaseManager
return
AltDatabaseManager
class
DummyDBTab
:
class
DummyDBTab
:
def
__init__
(
self
,
databases
=
None
):
def
__init__
(
self
,
databases
=
None
):
self
.
_databases
=
databases
or
{}
self
.
_databases
=
databases
or
{}
...
@@ -500,4 +514,5 @@ def test_suite():
...
@@ -500,4 +514,5 @@ def test_suite():
unittest
.
makeSuite
(
DatabaseChooserTests
),
unittest
.
makeSuite
(
DatabaseChooserTests
),
unittest
.
makeSuite
(
DebugManagerTests
),
unittest
.
makeSuite
(
DebugManagerTests
),
unittest
.
makeSuite
(
ApplicationManagerTests
),
unittest
.
makeSuite
(
ApplicationManagerTests
),
unittest
.
makeSuite
(
AltDatabaseManagerTests
),
))
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment