5 class PamSMTest(mocker.Mocker):
7 return arvados_pam.pam_sm_authenticate(self.pamh, 0, self.argv)
9 def test_success(self):
10 self.assertEqual(self.pamh.PAM_SUCCESS, self.attempt())
12 def test_bad_user(self):
13 self.pamh.get_user = mock.MagicMock(return_value='badusername')
14 self.assertEqual(self.pamh.PAM_AUTH_ERR, self.attempt())
16 def test_bad_vm(self):
17 self.argv[2] = 'testvm22.shell'
18 self.assertEqual(self.pamh.PAM_AUTH_ERR, self.attempt())
21 super(PamSMTest, self).setUp()
22 self.pamh = mock.MagicMock()
23 self.pamh.get_user = mock.MagicMock(return_value='active')
24 self.pamh.PAM_SUCCESS = 12345
25 self.pamh.PAM_AUTH_ERR = 54321
26 self.argv = [__file__, 'zzzzz.arvadosapi.com', 'testvm2.shell']