コード例 #1
0
    def setUp(self):
        userdata = {
            'username': 'test_user',
            'first_name': 'Bob',
            'last_name': 'Tremblay',
            'email': '[email protected]'
        }

        self.user_test = User(**userdata)
        self.user_test.save()

        teamhierarchydata = {
            'code': 'SomeValue',
            'description': 'Description of TeamHierarchy',
            'parentNode': None,
            'site': Site()
        }

        self.teamHierarchy = TeamHierarchy(**teamhierarchydata)
        self.teamHierarchy.save()

        usersharedata = {
            'user': self.user_test,
            'userTeam': self.teamHierarchy
        }

        self.userShare = UserShare(**usersharedata)
        self.userShare.save()
コード例 #2
0
class UserShareTest(TestCase):
    def setUp(self):
        userdata = {
            'username': 'test_user',
            'first_name': 'Bob',
            'last_name': 'Tremblay',
            'email': '[email protected]'
        }

        self.user_test = User(**userdata)
        self.user_test.save()

        teamhierarchydata = {
            'code': 'SomeValue',
            'description': 'Description of TeamHierarchy',
            'parentNode': None,
            'site': Site()
        }

        self.teamHierarchy = TeamHierarchy(**teamhierarchydata)
        self.teamHierarchy.save()

        usersharedata = {
            'user': self.user_test,
            'userTeam': self.teamHierarchy
        }

        self.userShare = UserShare(**usersharedata)
        self.userShare.save()

    def tearDown(self):
        self.userShare.delete()
        self.teamHierarchy.delete()
        self.user_test.delete()

    def test_verifying_string_representation(self):
        self.assertEqual(self.userShare.user.username + '-' + self.userShare.userTeam.code, str(self.userShare))