Exemplo n.º 1
0
    def test_requires(self):
        class RequiresTitle(State):
            requires = ['title']

        state = State(self.bug)
        transitions.add((State, RequiresTitle))
        with self.assertRaises(TransitionError):
            state.move_to(RequiresTitle, user=self.user2)

        state.move_to(RequiresTitle, user=self.user2, title='title')
Exemplo n.º 2
0
    def test_requires(self):
        class RequiresTitle(State):
            requires = ['title']

        state = State(self.bug)
        transitions.add((State, RequiresTitle))
        with self.assertRaises(TransitionError):
            state.move_to(RequiresTitle, user=self.user2)

        state.move_to(RequiresTitle, user=self.user2, title='title')
Exemplo n.º 3
0
    def test_assign_to(self):
        @staticmethod
        def get_user1(bug):
            return self.user1

        class AssignToState(State):
            assign_to = get_user1

        state = State(self.bug)
        transitions.add((State, AssignToState))
        state.move_to(AssignToState, user=self.user2)

        bug = refresh(self.bug)
        self.assertEqual(bug.assigned_to, self.user1)
Exemplo n.º 4
0
    def test_assign_to(self):
        @staticmethod
        def get_user1(bug):
            return self.user1

        class AssignToState(State):
            assign_to = get_user1

        state = State(self.bug)
        transitions.add((State, AssignToState))
        state.move_to(AssignToState, user=self.user2)

        bug = refresh(self.bug)
        self.assertEqual(bug.assigned_to, self.user1)