Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GDYendell committed Jun 21, 2016
1 parent ccabd50 commit ca34b61
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_core/test_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,23 @@ def test_transition(self):
self.m1.set_writeable.assert_called_once_with(True)
self.m2.set_writeable.assert_called_once_with(False)

def test_transition_not_busy(self):
self.c.writeable_methods["Configure"] = "say_hello"
self.c.stateMachine.allowed_transitions = dict(Idle="Configure")
self.c.state.value = "Idle"
self.c.stateMachine.busy_states = []

self.c.transition("Configure", "Attempting to configure scan...")

self.assertFalse(self.c.busy.value)

def test_transition_raises(self):
self.c.stateMachine.allowed_transitions = dict(Idle="")
self.c.state.value = "Idle"

with self.assertRaises(TypeError):
self.c.transition("Configure", "Attempting to configure scan...")

def test_set_writeable_methods(self):
m = MagicMock()
m.name = "configure"
Expand Down

0 comments on commit ca34b61

Please sign in to comment.