add osusers.tests.test_models.ShadowTest

This commit is contained in:
Jan Dittberner 2014-06-01 16:09:30 +02:00
parent 20f5686d85
commit c270a6087e

View file

@ -117,6 +117,16 @@ class ShadowTest(TestCaseWithCeleryTasks):
shadow = Shadow(user=user) shadow = Shadow(user=user)
self.assertEqual(str(shadow), 'for user test (1000)') self.assertEqual(str(shadow), 'for user test (1000)')
def test_set_password(self):
group = Group.objects.create(
groupname='test', gid=1000)
user = User.objects.create(
username='test', uid=1000, group=group, homedir='/home/test',
shell='/bin/bash')
shadow = Shadow(user=user)
shadow.set_password('test')
self.assertTrue(sha512_crypt.verify('test', shadow.passwd))
TEST_TASK_UUID = '3120f6a8-2665-4fa3-a785-79efd28bfe92' TEST_TASK_UUID = '3120f6a8-2665-4fa3-a785-79efd28bfe92'
TEST_TASK_NAME = 'test.task' TEST_TASK_NAME = 'test.task'