Пример #1
0
 def test_gen_password(self):
     """
     Test shadow.gen_password
     """
     self.assertTrue(HAS_SHADOW)
     for algorithm, hash_info in _HASHES.items():
         self.assertEqual(
             shadow.gen_password(
                 _PASSWORD, crypt_salt=hash_info["pw_salt"], algorithm=algorithm
             ),
             hash_info["pw_hash"],
         )
Пример #2
0
 def setUp(self):
     """
     Get current settings
     """
     self._password = self.run_function("shadow.gen_password",
                                        ["Password1234"])
     if "ERROR" in self._password:
         self.fail("Failed to generate password: {0}".format(
             self._password))
     super(ShadowModuleTest, self).setUp()
     os_grain = self.run_function("grains.item", ["kernel"])
     if os_grain["kernel"] not in "Linux":
         self.skipTest(
             "Test not applicable to '{kernel}' kernel".format(**os_grain))
     self._test_user = self.__random_string()
     self._no_user = self.__random_string()
     self._password = shadow.gen_password("Password1234")