diff --git a/django_states/model_methods.py b/django_states/model_methods.py index 37acbfd..c7f6e0f 100644 --- a/django_states/model_methods.py +++ b/django_states/model_methods.py @@ -147,7 +147,7 @@ def test_transition(si_self, transition, user=None): if validation_errors: raise TransitionNotValidated(si_self, transition, validation_errors) - return True + return si_self def make_transition(si_self, transition, user=None, **kwargs): """ diff --git a/django_states/tests.py b/django_states/tests.py index 85a00fb..f144f06 100644 --- a/django_states/tests.py +++ b/django_states/tests.py @@ -381,7 +381,10 @@ def test_initial_state(self): self.assertEqual(testclass.state, 'start') self.assertTrue(state_info.initial) - state_info.make_transition('start_step_1', user=self.superuser) + state_info.test_transition('start_step_1', user=self.superuser) + with self.assertRaises(PermissionDenied): + state_info.test_transition('start_step_1', user=User(username='user1')) + state_info.test_transition('start_step_1', user=self.superuser).make_transition('start_step_1', user=self.superuser) self.assertFalse(state_info.initial) def test_end_to_end(self):