Skip to content

Commit

Permalink
Makes test_transition chainable (fixes #56)
Browse files Browse the repository at this point in the history
  • Loading branch information
gvangool committed May 30, 2016
1 parent 3874e5a commit bc1ab45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion django_states/model_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
5 changes: 4 additions & 1 deletion django_states/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit bc1ab45

Please sign in to comment.