1c342db35SBrad Bishop#
2c342db35SBrad Bishop# SPDX-License-Identifier: MIT
3c342db35SBrad Bishop#
4c342db35SBrad Bishop
5eb8dc403SDave Cobbley# This test should cover https://bugzilla.yoctoproject.org/tr_show_case.cgi?case_id=287 testcase
6eb8dc403SDave Cobbley# Note that the image under test must have "pam" in DISTRO_FEATURES
7eb8dc403SDave Cobbley
8eb8dc403SDave Cobbleyfrom oeqa.runtime.case import OERuntimeTestCase
9eb8dc403SDave Cobbleyfrom oeqa.core.decorator.depends import OETestDepends
10eb8dc403SDave Cobbleyfrom oeqa.core.decorator.data import skipIfNotFeature
11*90fd73cbSAndrew Geisslerfrom oeqa.runtime.decorator.package import OEHasPackage
12eb8dc403SDave Cobbley
13eb8dc403SDave Cobbleyclass PamBasicTest(OERuntimeTestCase):
14eb8dc403SDave Cobbley
15eb8dc403SDave Cobbley    @skipIfNotFeature('pam', 'Test requires pam to be in DISTRO_FEATURES')
16eb8dc403SDave Cobbley    @OETestDepends(['ssh.SSHTest.test_ssh'])
17*90fd73cbSAndrew Geissler    @OEHasPackage(['shadow'])
18*90fd73cbSAndrew Geissler    @OEHasPackage(['shadow-base'])
19eb8dc403SDave Cobbley    def test_pam(self):
20eb8dc403SDave Cobbley        status, output = self.target.run('login --help')
21eb8dc403SDave Cobbley        msg = ('login command does not work as expected. '
22eb8dc403SDave Cobbley               'Status and output:%s and %s' % (status, output))
23eb8dc403SDave Cobbley        self.assertEqual(status, 1, msg = msg)
24eb8dc403SDave Cobbley
25eb8dc403SDave Cobbley        status, output = self.target.run('passwd --help')
26eb8dc403SDave Cobbley        msg = ('passwd command does not work as expected. '
27eb8dc403SDave Cobbley               'Status and output:%s and %s' % (status, output))
28eb8dc403SDave Cobbley        self.assertEqual(status, 0, msg = msg)
29eb8dc403SDave Cobbley
30eb8dc403SDave Cobbley        status, output = self.target.run('su --help')
31eb8dc403SDave Cobbley        msg = ('su command does not work as expected. '
32eb8dc403SDave Cobbley               'Status and output:%s and %s' % (status, output))
33eb8dc403SDave Cobbley        self.assertEqual(status, 0, msg = msg)
34eb8dc403SDave Cobbley
35eb8dc403SDave Cobbley        status, output = self.target.run('useradd --help')
36eb8dc403SDave Cobbley        msg = ('useradd command does not work as expected. '
37eb8dc403SDave Cobbley               'Status and output:%s and %s' % (status, output))
38eb8dc403SDave Cobbley        self.assertEqual(status, 0, msg = msg)
39