File: test_daemon.py

package info (click to toggle)
pystemd 0.13.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,296 kB
  • sloc: python: 1,431; sh: 17; makefile: 8
file content (28 lines) | stat: -rw-r--r-- 702 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python3
#
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree.
#

from unittest import TestCase

from pystemd import daemon


class TestNotify(TestCase):
    def test_notify(self):
        notify_status = daemon.notify(
            False, "STATUS=one...", b"STATUS=two....", status="last..."
        )
        self.assertIn(notify_status, {0, 1})


class TestListen(TestCase):
    def test_notify(self):
        self.assertTrue(daemon.listen_fds(False) >= 0)

    def test_listen_fds_start(self):
        self.assertEqual(daemon.LISTEN_FDS_START, 3)