def setUp(self): self.root_controller = BaseViewController() self.child_one = BaseViewController() self.child_two = BaseViewController() self.child_three = BaseViewController() self.vs = ViewState(self.root_controller) self.root_controller.set_named_child('one', self.child_one) self.child_one.set_named_child('two', self.child_two) self.child_two.set_named_child('three', self.child_three)
def test_component_path_insert(self): """A component can be inserted directly using a path, replacing the existing stack there.""" new_component = BaseViewController() self.child_one.set_named_child = MagicMock() self.vs.insert_controller('page.one.four', new_component) self.child_one.set_named_child.assert_called_with( 'four', new_component)