def test_mount(self, mocker): mock_mount = mocker.patch.object(elements.Element, 'mount') obj = elements.Method(None, 'func') result = obj.mount('delegation') assert result == mock_mount.return_value mock_mount.assert_called_once_with('delegation')
def test_init_alt(self, mocker): mock_init = mocker.patch.object( elements.Element, '__init__', return_value=None, ) result = elements.Method(None, 'func', 'parent') assert result.func == 'func' mock_init.assert_called_once_with(None, 'parent')
def test_init_base(self, mocker): mock_init = mocker.patch.object( elements.Element, '__init__', return_value=None, ) result = elements.Method('get', 'func') assert result.func == 'func' mock_init.assert_called_once_with('GET', None)
def test_route_alt(self): obj = elements.Method(None, 'func') with pytest.raises(ValueError): obj.route('get', 'put')
def test_route_base(self): obj = elements.Method(None, 'func') with pytest.raises(ValueError): obj.route()
def test_bind_alt(self): obj = elements.Method(None, 'func') with pytest.raises(ValueError): obj.bind('ident')
def test_path_base(self): obj = elements.Method(None, 'func') with pytest.raises(ValueError): obj.path()
def test_set_ident(self): obj = elements.Method(None, 'func') with pytest.raises(ValueError): obj.set_ident('ident')