def test_known_transition_should_succeed(self):
        self.assertTrue(can_proceed(self.model.publish))
        self.model.publish()
        self.assertEqual(self.model.state, 'published')

        self.assertTrue(can_proceed(self.model.hide))
        self.model.hide()
        self.assertEqual(self.model.state, 'hidden')
    def test_known_transition_should_succeed(self):
        self.assertTrue(can_proceed(self.model.publish))
        self.model.publish()
        self.assertEqual(self.model.state, 'published')

        self.assertTrue(can_proceed(self.model.hide))
        self.model.hide()
        self.assertEqual(self.model.state, 'hidden')
 def test_star_shortcut_succeed(self):
     self.assertTrue(can_proceed(self.model.moderate))
     self.model.moderate()
     self.assertEqual(self.model.state, 'moderated')
 def test_state_non_changed_after_fail(self):
     self.assertRaises(Exception, self.model.remove)
     self.assertTrue(can_proceed(self.model.remove))
     self.assertEqual(self.model.state, 'new')
 def test_unknow_transition_fails(self):
     self.assertFalse(can_proceed(self.model.hide))
     self.assertRaises(InvalidTransition, self.model.hide)
 def test_unmet_condition(self):
     self.model.publish()
     self.assertEqual(self.model.state, 'published')
     self.assertFalse(can_proceed(self.model.destroy))
     self.model.destroy()
     self.assertEqual(self.model.state, 'published')
 def test_star_shortcut_succeed(self):
     self.assertTrue(can_proceed(self.model.moderate))
     self.model.moderate()
     self.assertEqual(self.model.state, 'moderated')
 def test_state_non_changed_after_fail(self):
     self.assertRaises(Exception, self.model.remove)
     self.assertTrue(can_proceed(self.model.remove))
     self.assertEqual(self.model.state, 'new')
Exemple #9
0
 def test_unknow_transition_fails(self):
     self.assertFalse(can_proceed(self.model.hide))
     self.assertRaises(NotImplementedError, self.model.hide)
 def test_unmet_condition(self):
     self.model.publish()
     self.assertEqual(self.model.state, 'published')
     self.assertFalse(can_proceed(self.model.destroy))
     self.model.destroy()
     self.assertEqual(self.model.state, 'published')
Exemple #11
0
 def test_unknow_transition_fails(self):
   self.assertFalse(can_proceed(self.model.hide))
   self.assertRaises(InvalidTransition, self.model.hide)