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