• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zopefoundation / Zope / 3956162881

pending completion
3956162881

push

github

Michael Howitz
Update to deprecation warning free releases.

4401 of 7036 branches covered (62.55%)

Branch coverage included in aggregate %.

27161 of 31488 relevant lines covered (86.26%)

0.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.14
/src/App/tests/test_ApplicationManager.py
1
import os
1✔
2
import shutil
1✔
3
import sys
1✔
4
import tempfile
1✔
5
import time
1✔
6
import unittest
1✔
7

8
import Testing.testbrowser
1✔
9
import Testing.ZopeTestCase
1✔
10

11

12
class DummyForm:
1✔
13

14
    def __call__(self, *args, **kw):
1✔
15
        return kw
1✔
16

17

18
class DummyConnection:
1✔
19

20
    def __init__(self, db):
1✔
21
        self.__db = db
1✔
22

23
    def db(self):
1✔
24
        return self.__db
1✔
25

26

27
class DummyDBTab:
1✔
28
    def __init__(self, databases=None):
1✔
29
        self._databases = databases or {}
1✔
30

31
    def listDatabaseNames(self):
1✔
32
        return list(self._databases.keys())
1✔
33

34
    def hasDatabase(self, name):
1✔
35
        return name in self._databases
1✔
36

37
    def getDatabase(self, name):
1✔
38
        return self._databases[name]
1✔
39

40

41
class DummyDB:
1✔
42

43
    _packed = None
1✔
44

45
    def __init__(self, name, size, cache_size):
1✔
46
        self._name = name
1✔
47
        self._size = size
1✔
48
        self._cache_size = cache_size
1✔
49

50
    def getName(self):
1✔
51
        return self._name
1✔
52

53
    def getSize(self):
1✔
54
        return self._size
1✔
55

56
    def getCacheSize(self):
1✔
57
        return self._cache_size
1✔
58

59
    def pack(self, when):
1✔
60
        self._packed = when
1✔
61

62
    def undoInfo(self, first_transaction, last_transaction):
1✔
63
        return [{'time': 1,
1✔
64
                 'description': 'Transaction 1',
65
                 'id': b'id1'}]
66

67
    def undoMultiple(self, tids):
1✔
68
        pass
1✔
69

70

71
class DummyTransaction:
1✔
72

73
    def __init__(self, raises=False):
1✔
74
        self.raises = raises
1✔
75
        self.aborted = False
1✔
76

77
    def note(self, note):
1✔
78
        self._note = note
1✔
79

80
    def commit(self):
1✔
81
        if self.raises:
1!
82
            raise RuntimeError('This did not work')
1✔
83

84
    def abort(self):
1✔
85
        self.aborted = True
1✔
86

87

88
class DummyTransactionModule:
1✔
89

90
    def __init__(self, raises=False):
1✔
91
        self.ts = DummyTransaction(raises=raises)
1✔
92

93
    def get(self):
1✔
94
        return self.ts
1✔
95

96

97
class ConfigTestBase:
1✔
98

99
    def setUp(self):
1✔
100
        super().setUp()
1✔
101
        import App.config
1✔
102
        self._old_config = App.config._config
1✔
103

104
    def tearDown(self):
1✔
105
        import App.config
1✔
106
        App.config._config = self._old_config
1✔
107
        super().tearDown()
1✔
108

109
    def _makeConfig(self, **kw):
1✔
110
        import App.config
1✔
111

112
        class DummyConfig:
1✔
113
            def __init__(self):
1✔
114
                self.debug_mode = False
1✔
115

116
        App.config._config = config = DummyConfig()
1✔
117
        config.dbtab = DummyDBTab(kw)
1✔
118
        return config
1✔
119

120

121
class FakeConnectionTests(unittest.TestCase):
1✔
122

123
    def _getTargetClass(self):
1✔
124
        from App.ApplicationManager import FakeConnection
1✔
125
        return FakeConnection
1✔
126

127
    def _makeOne(self, db, parent_jar):
1✔
128
        return self._getTargetClass()(db, parent_jar)
1✔
129

130
    def test_holds_db(self):
1✔
131
        db = object()
1✔
132
        parent_jar = object()
1✔
133
        fc = self._makeOne(db, parent_jar)
1✔
134
        self.assertTrue(fc.db() is db)
1✔
135

136

137
class ConfigurationViewerTests(ConfigTestBase, unittest.TestCase):
1✔
138

139
    def _getTargetClass(self):
1✔
140
        from App.ApplicationManager import ConfigurationViewer
1✔
141
        return ConfigurationViewer
1✔
142

143
    def _makeOne(self):
1✔
144
        return self._getTargetClass()()
1✔
145

146
    def test_defaults(self):
1✔
147
        cv = self._makeOne()
1✔
148
        self.assertEqual(cv.id, 'Configuration')
1✔
149
        self.assertEqual(cv.meta_type, 'Configuration Viewer')
1✔
150
        self.assertEqual(cv.title, 'Configuration Viewer')
1✔
151

152
    def test_manage_getSysPath(self):
1✔
153
        cv = self._makeOne()
1✔
154
        self.assertEqual(cv.manage_getSysPath(), sorted(sys.path))
1✔
155

156
    def test_manage_getConfiguration(self):
1✔
157
        from App.config import getConfiguration
1✔
158
        cv = self._makeOne()
1✔
159
        cfg = getConfiguration()
1✔
160

161
        for info_dict in cv.manage_getConfiguration():
1✔
162
            self.assertEqual(info_dict['value'],
1✔
163
                             str(getattr(cfg, info_dict['name'])))
164

165

166
class DatabaseChooserTests(ConfigTestBase, unittest.TestCase):
1✔
167

168
    def _getTargetClass(self):
1✔
169
        from App.ApplicationManager import DatabaseChooser
1✔
170
        return DatabaseChooser
1✔
171

172
    def _makeOne(self):
1✔
173
        return self._getTargetClass()()
1✔
174

175
    def _makeRoot(self):
1✔
176
        from ExtensionClass import Base
1✔
177

178
        class Root(Base):
1✔
179
            _p_jar = None
1✔
180

181
            def getPhysicalRoot(self):
1✔
182
                return self
1✔
183
        return Root()
1✔
184

185
    def test_getDatabaseNames_sorted(self):
1✔
186
        self._makeConfig(foo=object(), bar=object(), qux=object())
1✔
187
        dc = self._makeOne()
1✔
188
        self.assertEqual(list(dc.getDatabaseNames()), ['bar', 'foo', 'qux'])
1✔
189

190
    def test___getitem___miss(self):
1✔
191
        self._makeConfig(foo=object(), bar=object(), qux=object())
1✔
192
        dc = self._makeOne()
1✔
193
        self.assertRaises(KeyError, dc.__getitem__, 'nonesuch')
1✔
194

195
    def test___getitem___hit(self):
1✔
196
        from App.ApplicationManager import AltDatabaseManager
1✔
197
        from App.ApplicationManager import FakeConnection
1✔
198
        foo = object()
1✔
199
        bar = object()
1✔
200
        qux = object()
1✔
201
        self._makeConfig(foo=foo, bar=bar, qux=qux)
1✔
202
        root = self._makeRoot()
1✔
203
        dc = self._makeOne().__of__(root)
1✔
204
        found = dc['foo']
1✔
205
        self.assertIsInstance(found, AltDatabaseManager)
1✔
206
        self.assertEqual(found.id, 'foo')
1✔
207
        self.assertTrue(found.__parent__ is dc)
1✔
208
        conn = found._p_jar
1✔
209
        self.assertIsInstance(conn, FakeConnection)
1✔
210
        self.assertTrue(conn.db() is foo)
1✔
211

212
    def test___bobo_traverse___miss(self):
1✔
213
        self._makeConfig(foo=object(), bar=object(), qux=object())
1✔
214
        dc = self._makeOne()
1✔
215
        self.assertRaises(AttributeError,
1✔
216
                          dc.__bobo_traverse__, None, 'nonesuch')
217

218
    def test___bobo_traverse___hit_db(self):
1✔
219
        from App.ApplicationManager import AltDatabaseManager
1✔
220
        from App.ApplicationManager import FakeConnection
1✔
221
        foo = object()
1✔
222
        bar = object()
1✔
223
        qux = object()
1✔
224
        self._makeConfig(foo=foo, bar=bar, qux=qux)
1✔
225
        root = self._makeRoot()
1✔
226
        dc = self._makeOne().__of__(root)
1✔
227
        found = dc.__bobo_traverse__(None, 'foo')
1✔
228
        self.assertIsInstance(found, AltDatabaseManager)
1✔
229
        self.assertEqual(found.id, 'foo')
1✔
230
        self.assertTrue(found.__parent__ is dc)
1✔
231
        conn = found._p_jar
1✔
232
        self.assertIsInstance(conn, FakeConnection)
1✔
233
        self.assertTrue(conn.db() is foo)
1✔
234

235
    def test___bobo_traverse___miss_db_hit_attr(self):
1✔
236
        foo = object()
1✔
237
        bar = object()
1✔
238
        qux = object()
1✔
239
        self._makeConfig(foo=foo, bar=bar, qux=qux)
1✔
240
        root = self._makeRoot()
1✔
241
        dc = self._makeOne().__of__(root)
1✔
242
        dc.spam = spam = object()
1✔
243
        found = dc.__bobo_traverse__(None, 'spam')
1✔
244
        self.assertTrue(found is spam)
1✔
245

246

247
class ApplicationManagerTests(ConfigTestBase, unittest.TestCase):
1✔
248

249
    def setUp(self):
1✔
250
        ConfigTestBase.setUp(self)
1✔
251
        self._tempdirs = ()
1✔
252

253
    def tearDown(self):
1✔
254
        for tempdir in self._tempdirs:
1✔
255
            shutil.rmtree(tempdir)
1✔
256
        ConfigTestBase.tearDown(self)
1✔
257

258
    def _getTargetClass(self):
1✔
259
        from App.ApplicationManager import ApplicationManager
1✔
260
        return ApplicationManager
1✔
261

262
    def _makeOne(self):
1✔
263
        return self._getTargetClass()()
1✔
264

265
    def _makeTempdir(self):
1✔
266
        tmp = tempfile.mkdtemp()
1✔
267
        self._tempdirs += (tmp,)
1✔
268
        return tmp
1✔
269

270
    def _makeFile(self, dir, name, text):
1✔
271
        os.makedirs(dir)
×
272
        fqn = os.path.join(dir, name)
×
273
        f = open(fqn, 'w')
×
274
        f.write(text)
×
275
        f.flush()
×
276
        f.close()
×
277
        return fqn
×
278

279
    def test_version_txt(self):
1✔
280
        from App.version_txt import version_txt
1✔
281
        am = self._makeOne()
1✔
282
        self.assertEqual(am.version_txt(), version_txt())
1✔
283

284
    def test_sys_version(self):
1✔
285
        am = self._makeOne()
1✔
286
        self.assertEqual(am.sys_version(), sys.version)
1✔
287

288
    def test_sys_platform(self):
1✔
289
        am = self._makeOne()
1✔
290
        self.assertEqual(am.sys_platform(), sys.platform)
1✔
291

292
    def test_getINSTANCE_HOME(self):
1✔
293
        am = self._makeOne()
1✔
294
        config = self._makeConfig()
1✔
295
        instdir = config.instancehome = self._makeTempdir()
1✔
296
        self.assertEqual(am.getINSTANCE_HOME(), instdir)
1✔
297

298
    def test_getCLIENT_HOME(self):
1✔
299
        am = self._makeOne()
1✔
300
        config = self._makeConfig()
1✔
301
        cldir = config.clienthome = self._makeTempdir()
1✔
302
        self.assertEqual(am.getCLIENT_HOME(), cldir)
1✔
303

304
    def test_process_time(self):
1✔
305
        am = self._makeOne()
1✔
306
        now = time.time()
1✔
307

308
        measure, unit = am.process_time(_when=now).strip().split()
1✔
309
        self.assertEqual(unit, 'sec')
1✔
310

311
        ret_str = am.process_time(_when=now + 90061).strip()
1✔
312
        secs = 1 + int(measure)
1✔
313
        self.assertEqual(ret_str, '1 day 1 hour 1 min %i sec' % secs)
1✔
314

315
        ret_str = am.process_time(_when=now + 180122).strip()
1✔
316
        secs = 2 + int(measure)
1✔
317
        self.assertEqual(ret_str, '2 days 2 hours 2 min %i sec' % secs)
1✔
318

319

320
class AltDatabaseManagerTests(unittest.TestCase):
1✔
321

322
    def _getTargetClass(self):
1✔
323
        from App.ApplicationManager import AltDatabaseManager
1✔
324
        return AltDatabaseManager
1✔
325

326
    def _makeOne(self):
1✔
327
        return self._getTargetClass()()
1✔
328

329
    def _makeJar(self, dbname, dbsize):
1✔
330
        class Jar:
1✔
331
            def db(self):
1✔
332
                return self._db
1✔
333
        jar = Jar()
1✔
334
        jar._db = DummyDB(dbname, dbsize, 0)
1✔
335
        return jar
1✔
336

337
    def _getManagerClass(self):
1✔
338
        adm = self._getTargetClass()
1✔
339

340
        class TestCacheManager(adm):
1✔
341
            # Derived CacheManager that fakes enough of the DatabaseManager to
342
            # make it possible to test at least some parts of the CacheManager.
343
            def __init__(self, connection):
1✔
344
                self._p_jar = connection
1✔
345
        return TestCacheManager
1✔
346

347
    def test_cache_size(self):
1✔
348
        db = DummyDB('db', 0, 42)
1✔
349
        connection = DummyConnection(db)
1✔
350
        manager = self._getManagerClass()(connection)
1✔
351
        self.assertEqual(manager.cache_size(), 42)
1✔
352
        db._cache_size = 12
1✔
353
        self.assertEqual(manager.cache_size(), 12)
1✔
354

355
    def test_db_name(self):
1✔
356
        am = self._makeOne()
1✔
357
        am._p_jar = self._makeJar('foo', '')
1✔
358
        self.assertEqual(am.db_name(), 'foo')
1✔
359

360
    def test_db_size_string(self):
1✔
361
        am = self._makeOne()
1✔
362
        am._p_jar = self._makeJar('foo', 'super')
1✔
363
        self.assertEqual(am.db_size(), 'super')
1✔
364

365
    def test_db_size_lt_1_meg(self):
1✔
366
        am = self._makeOne()
1✔
367
        am._p_jar = self._makeJar('foo', 4497)
1✔
368
        self.assertEqual(am.db_size(), '4.4K')
1✔
369

370
    def test_db_size_gt_1_meg(self):
1✔
371
        am = self._makeOne()
1✔
372
        am._p_jar = self._makeJar('foo', (2048 * 1024) + 123240)
1✔
373
        self.assertEqual(am.db_size(), '2.1M')
1✔
374

375
    def test_manage_pack(self):
1✔
376
        am = self._makeOne()
1✔
377
        am._p_jar = self._makeJar('foo', '')
1✔
378

379
        # The default value for days is 0, meaning pack to now
380
        pack_to = time.time()
1✔
381
        am.manage_pack()
1✔
382
        self.assertAlmostEqual(am._getDB()._packed, pack_to, delta=1)
1✔
383

384
        # Try a float value
385
        pack_to = time.time() - 10800  # 3 hrs, 0.125 days
1✔
386
        packed_to = am.manage_pack(days=.125)
1✔
387
        self.assertAlmostEqual(am._getDB()._packed, pack_to, delta=1)
1✔
388
        self.assertAlmostEqual(packed_to, pack_to, delta=1)
1✔
389

390
        # Try an integer
391
        pack_to = time.time() - 86400  # 1 day
1✔
392
        packed_to = am.manage_pack(days=1)
1✔
393
        self.assertAlmostEqual(am._getDB()._packed, pack_to, delta=1)
1✔
394
        self.assertAlmostEqual(packed_to, pack_to, delta=1)
1✔
395

396
        # Pass a string
397
        pack_to = time.time() - 97200  # 27 hrs, 1.125 days
1✔
398
        packed_to = am.manage_pack(days='1.125')
1✔
399
        self.assertAlmostEqual(am._getDB()._packed, pack_to, delta=1)
1✔
400
        self.assertAlmostEqual(packed_to, pack_to, delta=1)
1✔
401

402
        # Set the dummy storage pack indicator manually
403
        am._getDB()._packed = None
1✔
404
        # Pass an invalid value
405
        self.assertIsNone(am.manage_pack(days='foo'))
1✔
406
        # The dummy storage value should not change because pack was not called
407
        self.assertIsNone(am._getDB()._packed)
1✔
408

409
    def test_manage_undoTransactions_raises(self):
1✔
410
        # Patch in fake transaction module that will raise RuntimeError
411
        # on transaction commit
412
        try:
1✔
413
            import App.Undo
1✔
414
            trs_module = App.Undo.transaction
1✔
415
            App.Undo.transaction = DummyTransactionModule(raises=True)
1✔
416

417
            am = self._makeOne()
1✔
418
            am._p_jar = self._makeJar('foo', '')
1✔
419
            am.manage_UndoForm = DummyForm()
1✔
420
            undoable_tids = [x['id'] for x in am.undoable_transactions()]
1✔
421
            current_transaction = App.Undo.transaction.get()
1✔
422

423
            # If no REQUEST is passed in, the exception is re-raised unchanged
424
            # and the current transaction is left unchanged.
425
            self.assertRaises(RuntimeError,
1✔
426
                              am.manage_undo_transactions,
427
                              transaction_info=undoable_tids)
428
            self.assertFalse(current_transaction.aborted)
1✔
429

430
            # If a REQUEST is passed in, the transaction will be aborted and
431
            # the exception is caught. The DummyForm instance shows the
432
            # call arguments so the exception data is visible.
433
            res = am.manage_undo_transactions(transaction_info=undoable_tids,
1✔
434
                                              REQUEST={})
435
            expected = {
1✔
436
                'manage_tabs_message': 'RuntimeError: This did not work',
437
                'manage_tabs_type': 'danger'}
438
            self.assertDictEqual(res, expected)
1✔
439
            self.assertTrue(current_transaction.aborted)
1✔
440

441
        finally:
442
            # Cleanup
443
            App.Undo.transaction = trs_module
1✔
444

445

446
class DebugManagerTests(unittest.TestCase):
1✔
447

448
    def setUp(self):
1✔
449
        import sys
1✔
450
        self._sys = sys
1✔
451
        self._old_sys_modules = sys.modules.copy()
1✔
452

453
    def tearDown(self):
1✔
454
        self._sys.modules.clear()
1✔
455
        self._sys.modules.update(self._old_sys_modules)
1✔
456

457
    def _getTargetClass(self):
1✔
458
        from App.ApplicationManager import DebugManager
1✔
459
        return DebugManager
1✔
460

461
    def _makeOne(self, id):
1✔
462
        return self._getTargetClass()(id)
1✔
463

464
    def _makeModuleClasses(self):
1✔
465
        import sys
1✔
466
        import types
1✔
467

468
        from ExtensionClass import Base
1✔
469

470
        class Foo(Base):
1✔
471
            pass
1✔
472

473
        class Bar(Base):
1✔
474
            pass
1✔
475

476
        class Baz(Base):
1✔
477
            pass
1✔
478

479
        foo = sys.modules['foo'] = types.ModuleType('foo')
1✔
480
        foo.Foo = Foo
1✔
481
        Foo.__module__ = 'foo'
1✔
482
        foo.Bar = Bar
1✔
483
        Bar.__module__ = 'foo'
1✔
484
        qux = sys.modules['qux'] = types.ModuleType('qux')
1✔
485
        qux.Baz = Baz
1✔
486
        Baz.__module__ = 'qux'
1✔
487
        return Foo, Bar, Baz
1✔
488

489
    def test_refcount_no_limit(self):
1✔
490
        import sys
1✔
491
        dm = self._makeOne('test')
1✔
492
        Foo, Bar, Baz = self._makeModuleClasses()
1✔
493
        pairs = dm.refcount()
1✔
494
        # XXX : Ugly empiricism here:  I don't know why the count is up 1.
495
        foo_count = sys.getrefcount(Foo)
1✔
496
        self.assertTrue((foo_count + 1, 'foo.Foo') in pairs)
1✔
497
        bar_count = sys.getrefcount(Bar)
1✔
498
        self.assertTrue((bar_count + 1, 'foo.Bar') in pairs)
1✔
499
        baz_count = sys.getrefcount(Baz)
1✔
500
        self.assertTrue((baz_count + 1, 'qux.Baz') in pairs)
1✔
501

502
    def test_refdict(self):
1✔
503
        import sys
1✔
504
        dm = self._makeOne('test')
1✔
505
        Foo, Bar, Baz = self._makeModuleClasses()
1✔
506
        mapping = dm.refdict()
1✔
507
        # XXX : Ugly empiricism here:  I don't know why the count is up 1.
508
        foo_count = sys.getrefcount(Foo)
1✔
509
        self.assertEqual(mapping['foo.Foo'], foo_count + 1)
1✔
510
        bar_count = sys.getrefcount(Bar)
1✔
511
        self.assertEqual(mapping['foo.Bar'], bar_count + 1)
1✔
512
        baz_count = sys.getrefcount(Baz)
1✔
513
        self.assertEqual(mapping['qux.Baz'], baz_count + 1)
1✔
514

515
    def test_rcsnapshot(self):
1✔
516
        import sys
1✔
517

518
        import App.ApplicationManager
1✔
519
        from DateTime.DateTime import DateTime
1✔
520
        dm = self._makeOne('test')
1✔
521
        Foo, Bar, Baz = self._makeModuleClasses()
1✔
522
        before = DateTime()
1✔
523
        dm.rcsnapshot()
1✔
524
        after = DateTime()
1✔
525
        # XXX : Ugly empiricism here:  I don't know why the count is up 1.
526
        self.assertTrue(before <= App.ApplicationManager._v_rst <= after)
1✔
527
        mapping = App.ApplicationManager._v_rcs
1✔
528
        foo_count = sys.getrefcount(Foo)
1✔
529
        self.assertEqual(mapping['foo.Foo'], foo_count + 1)
1✔
530
        bar_count = sys.getrefcount(Bar)
1✔
531
        self.assertEqual(mapping['foo.Bar'], bar_count + 1)
1✔
532
        baz_count = sys.getrefcount(Baz)
1✔
533
        self.assertEqual(mapping['qux.Baz'], baz_count + 1)
1✔
534

535
    def test_rcdate(self):
1✔
536
        import App.ApplicationManager
1✔
537
        dummy = object()
1✔
538
        App.ApplicationManager._v_rst = dummy
1✔
539
        dm = self._makeOne('test')
1✔
540
        found = dm.rcdate()
1✔
541
        App.ApplicationManager._v_rst = None
1✔
542
        self.assertTrue(found is dummy)
1✔
543

544
    def test_rcdeltas(self):
1✔
545
        dm = self._makeOne('test')
1✔
546
        dm.rcsnapshot()
1✔
547
        Foo, Bar, Baz = self._makeModuleClasses()
1✔
548
        mappings = dm.rcdeltas()
1✔
549
        self.assertTrue(len(mappings))
1✔
550
        mapping = mappings[0]
1✔
551
        self.assertTrue('rc' in mapping)
1✔
552
        self.assertTrue('pc' in mapping)
1✔
553
        self.assertEqual(mapping['delta'], mapping['rc'] - mapping['pc'])
1✔
554

555
    # def test_dbconnections(self):  XXX -- TOO UGLY TO TEST
556

557
    def test_manage_getSysPath(self):
1✔
558
        import sys
1✔
559
        dm = self._makeOne('test')
1✔
560
        self.assertEqual(dm.manage_getSysPath(), list(sys.path))
1✔
561

562

563
class MenuDtmlTests(ConfigTestBase, Testing.ZopeTestCase.FunctionalTestCase):
1✔
564
    """Browser testing ..dtml.menu.dtml."""
565

566
    def setUp(self):
1✔
567
        super().setUp()
1✔
568
        uf = self.app.acl_users
1✔
569
        uf.userFolderAddUser('manager', 'manager_pass', ['Manager'], [])
1✔
570
        self.browser = Testing.testbrowser.Browser()
1✔
571
        self.browser.login('manager', 'manager_pass')
1✔
572

573
    def test_menu_dtml__1(self):
1✔
574
        """It contains the databases in navigation."""
575
        self._makeConfig(foo=object(), bar=object(), qux=object())
1✔
576
        self.browser.open('http://localhost/manage_menu')
1✔
577
        links = [
1✔
578
            self.browser.getLink('ZODB foo'),
579
            self.browser.getLink('ZODB bar'),
580
            self.browser.getLink('ZODB qux'),
581
        ]
582
        for link in links:
1✔
583
            self.assertEqual(
1✔
584
                link.attrs['title'], 'Zope Object Database Manager')
585

586
    def test_menu_dtml__2(self):
1✔
587
        """It still shows the navigation in case no database is configured."""
588
        # This effect can happen in tests, e.g. with `plone.testing`. There a
589
        # `Control_Panel` is not configured in the standard setup, so we will
590
        # get a `NameError` while trying to get the databases.
591
        self.browser.open('http://localhost/manage_menu')
1✔
592
        self.assertTrue(self.browser.isHtml)
1✔
593
        self.assertIn('Control Panel', self.browser.contents)
1✔
594
        self.assertNotIn('ZODB', self.browser.contents)
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc