File: t_slapdobject.py

package info (click to toggle)
python-ldap 3.4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,756 kB
  • sloc: python: 9,558; ansic: 3,052; makefile: 139; sh: 79
file content (18 lines) | stat: -rw-r--r-- 513 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import unittest

import slapdtest


class TestSlapdObject(unittest.TestCase):
    def test_context_manager(self):
        with slapdtest.SlapdObject() as server:
            self.assertIsNotNone(server._proc)
        self.assertIsNone(server._proc)

    def test_context_manager_after_start(self):
        server = slapdtest.SlapdObject()
        server.start()
        self.assertIsNotNone(server._proc)
        with server:
            self.assertIsNotNone(server._proc)
        self.assertIsNone(server._proc)