示例#1
0
    def test_0150_user_organisation(self):
        """
        Test the organisation property of user
        """
        user_2 = User(
            name="test-user",
            email="*****@*****.**",
        )
        user_2.set_password("openlabs")
        user_2.save()

        # Create organisations
        organisation_1 = Organisation(
            name="open labs", slug=slugify("open labs")
        )
        organisation_1.save()
        organisation_2 = Organisation(
            name="new organisation", slug=slugify("new organisation")
        )
        organisation_2.save()

        # Create teams
        team_developers = Team(
            name="Developers", organisation=organisation_1,
            members=[self.user, user_2]
        )
        team_developers.save()
        team_participants = Team(
            name="Paricipants", organisation=organisation_2,
            members=[self.user]
        )
        team_participants.save()
        self.assertEqual(len(self.user.organisations), 2)
        self.assertEqual(len(user_2.organisations), 1)
示例#2
0
 def setUp(self):
     new_user = User(
         name="Anoop sm",
         email="*****@*****.**",
     )
     new_user.set_password("openlabs")
     new_user.save()
     self.user = new_user
示例#3
0
 def setUp(self):
     super(TestProjects, self).setUp()
     user = User(name="Test User", email="*****@*****.**", active=True)
     user.set_password("password")
     user.save(safe=True)
     self.user = user
示例#4
0
 def setUp(self):
     super(TestOrganisations, self).setUp()
     user = User(name="Test User", email="*****@*****.**", active=True)
     user.set_password("password")
     user.save(safe=True)