예제 #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 tearDown(self):
     """
     Drop each collection after each test.
     """
     User.drop_collection()
     Organisation.drop_collection()
     Team.drop_collection()
     Project.drop_collection()
     Task.drop_collection()
     TaskList.drop_collection()
예제 #4
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
예제 #5
0
 def setUp(self):
     super(TestOrganisations, self).setUp()
     user = User(name="Test User", email="*****@*****.**", active=True)
     user.set_password("password")
     user.save(safe=True)