add test for osusers.models.Shadow.__str__
This commit is contained in:
parent
b9dd34d527
commit
8cec71fe1f
1 changed files with 21 additions and 15 deletions
|
@ -11,12 +11,16 @@ from osusers.models import (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class AdditionalGroupTest(TestCase):
|
|
||||||
@override_settings(
|
@override_settings(
|
||||||
CELERY_ALWAYS_EAGER=True,
|
CELERY_ALWAYS_EAGER=True,
|
||||||
CELERY_CACHE_BACKEND='memory',
|
CELERY_CACHE_BACKEND='memory',
|
||||||
BROKER_BACKEND='memory'
|
BROKER_BACKEND='memory'
|
||||||
)
|
)
|
||||||
|
class TestCaseWithCeleryTasks(TestCase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class AdditionalGroupTest(TestCaseWithCeleryTasks):
|
||||||
def test_clean_primary_group(self):
|
def test_clean_primary_group(self):
|
||||||
group1 = Group.objects.create(groupname='test1', gid=1000)
|
group1 = Group.objects.create(groupname='test1', gid=1000)
|
||||||
user = User.objects.create(
|
user = User.objects.create(
|
||||||
|
@ -28,11 +32,6 @@ class AdditionalGroupTest(TestCase):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
cm.exception.message, CANNOT_USE_PRIMARY_GROUP_AS_ADDITIONAL)
|
cm.exception.message, CANNOT_USE_PRIMARY_GROUP_AS_ADDITIONAL)
|
||||||
|
|
||||||
@override_settings(
|
|
||||||
CELERY_ALWAYS_EAGER=True,
|
|
||||||
CELERY_CACHE_BACKEND='memory',
|
|
||||||
BROKER_BACKEND='memory'
|
|
||||||
)
|
|
||||||
def test_clean_other_group(self):
|
def test_clean_other_group(self):
|
||||||
group1 = Group(groupname='test1', gid=1000)
|
group1 = Group(groupname='test1', gid=1000)
|
||||||
group2 = Group(groupname='test2', gid=1001)
|
group2 = Group(groupname='test2', gid=1001)
|
||||||
|
@ -42,13 +41,20 @@ class AdditionalGroupTest(TestCase):
|
||||||
testsubj.clean()
|
testsubj.clean()
|
||||||
|
|
||||||
|
|
||||||
class GroupTest(TestCase):
|
class GroupTest(TestCaseWithCeleryTasks):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ShadowTest(TestCase):
|
class ShadowTest(TestCaseWithCeleryTasks):
|
||||||
pass
|
def test___str__(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)
|
||||||
|
self.assertEqual(str(shadow), 'for user test (1000)')
|
||||||
|
|
||||||
|
|
||||||
class UserTest(TestCase):
|
class UserTest(TestCaseWithCeleryTasks):
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in a new issue