Example #1
0
    def test_checkPasswdFile_invalid(self):
        """
        When an invalid password is provided, on most OS system password is not
        stored in the passwd file it return None to inform that
        password is not here.
        On systems with passwd it return False.
        """
        result = system_users._checkPasswdFile(
            username=TEST_ACCOUNT_USERNAME, password='')

        if self.os_name in ['aix', 'hpux']:
            # On AIX and HPUX invalid passwords are not accepted.
            self.assertFalse(result)
        else:
            # On all other OSs password is not here.
            self.assertIsNone(result)
Example #2
0
    def test_checkPasswdFile_valid(self):
        """
        On most OS system password is not stored in the passwd file so even
        if we pass the correct pass it will return None to inform that
        password is not here.
        """
        result = system_users._checkPasswdFile(
            username=TEST_ACCOUNT_USERNAME,
            password=TEST_ACCOUNT_PASSWORD,
            )

        if self.os_name in ['aix', 'hpux']:
            # On AIX and HPUX password is here.
            self.assertTrue(result)
        else:
            # Not here.
            self.assertIsNone(result)