Add tests for UTMP methods

This commit is contained in:
Matt Fellenz 2021-10-04 20:35:26 -07:00
parent 072e583835
commit 1d4a86594b
No known key found for this signature in database
GPG Key ID: 65AA03A4E6F03CD4

13
kitty_tests/utmp.py Normal file
View File

@ -0,0 +1,13 @@
from sys import platform
if platform in ('linux', 'linux2'):
import subprocess
import re
from kitty.fast_data_types import num_users
from . import BaseTest
class UTMPTest(BaseTest):
def test_num_users(self):
# who -q is the control
expected = subprocess.run(['who'], capture_output=True).stdout.decode('utf-8').count('\n')
self.ae(num_users(), expected)