Esempio n. 1
0
    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')
Esempio n. 2
0
    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')
Esempio n. 3
0
    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)
Esempio n. 4
0
    def test_route_alt(self):
        obj = elements.Method(None, 'func')

        with pytest.raises(ValueError):
            obj.route('get', 'put')
Esempio n. 5
0
    def test_route_base(self):
        obj = elements.Method(None, 'func')

        with pytest.raises(ValueError):
            obj.route()
Esempio n. 6
0
    def test_bind_alt(self):
        obj = elements.Method(None, 'func')

        with pytest.raises(ValueError):
            obj.bind('ident')
Esempio n. 7
0
    def test_path_base(self):
        obj = elements.Method(None, 'func')

        with pytest.raises(ValueError):
            obj.path()
Esempio n. 8
0
    def test_set_ident(self):
        obj = elements.Method(None, 'func')

        with pytest.raises(ValueError):
            obj.set_ident('ident')