Esempio n. 1
0
    def test_cant_have_owner_in_members(self):
        u1 = UserFactory.create()

        try:
            Team.create(name="test-team-owner-in-members", owner=u1, members=[u1])
        except ValueError:
            ex = sys.exc_info()[1]
            expect(ex).to_have_an_error_message_of("Can't have a team owner in the members collection.")
            return

        assert False, "Should not have gotten this far"
Esempio n. 2
0
    def test_cant_have_same_member_twice(self):
        u1 = UserFactory.create()
        u2 = UserFactory.create()

        try:
            Team.create(name="test-team-same-member-twice", owner=u1, members=[u2, u2])
        except ValueError:
            ex = sys.exc_info()[1]
            expect(ex).to_have_an_error_message_of("Can't have the same user twice in the members collection.")
            return
        assert False, "Should not have gotten this far"
Esempio n. 3
0
    def test_cant_have_owner_in_members(self):
        u1 = UserFactory.create()

        try:
            Team.create(name="test-team-owner-in-members",
                        owner=u1,
                        members=[u1])
        except ValueError:
            ex = sys.exc_info()[1]
            expect(ex).to_have_an_error_message_of(
                "Can't have a team owner in the members collection.")
            return

        assert False, "Should not have gotten this far"
Esempio n. 4
0
    def test_cant_have_same_member_twice(self):
        u1 = UserFactory.create()
        u2 = UserFactory.create()

        try:
            Team.create(name="test-team-same-member-twice",
                        owner=u1,
                        members=[u2, u2])
        except ValueError:
            ex = sys.exc_info()[1]
            expect(ex).to_have_an_error_message_of(
                "Can't have the same user twice in the members collection.")
            return
        assert False, "Should not have gotten this far"
Esempio n. 5
0
    def post(self, team_name):
        name = self.get_argument("name").strip()
        team = Team.create(name, owner=self.current_user)

        if team is None:
            self.set_status(409)
            self.finish()
            return

        self.set_status(200)
        self.write("OK")
        self.finish()
Esempio n. 6
0
 def test_cant_have_null_owner(self):
     try:
         Team.create(name="null-owner-5", owner=None)
     except ValidationError:
         return
     assert False, "Should not have gotten this far"
Esempio n. 7
0
 def test_cant_create_team_with_same_name(self):
     team = TeamFactory.create()
     team = Team.create(name=team.name, owner=team.owner)
     expect(team).to_be_null()
Esempio n. 8
0
 def test_cant_have_null_owner(self):
     try:
         Team.create(name="null-owner-5", owner=None)
     except ValidationError:
         return
     assert False, "Should not have gotten this far"
Esempio n. 9
0
 def test_cant_create_team_with_same_name(self):
     team = TeamFactory.create()
     team = Team.create(name=team.name, owner=team.owner)
     expect(team).to_be_null()