# Path: flask_via/routers/restful.py
# class Resource(BaseRouter):
#     def __init__(self, url, resource, endpoint=None):
#     def add_to_app(self, app, **kwargs):


import mock
import unittest
from flask_via.routers import restful
Unit tests for the Flask-Restful resource router.
"""




class TestRestfulRouter(unittest.TestCase):

    def setUp(self):
        self.app = mock.MagicMock()

    def test_add_to_app_raises_not_implemented(self):

        resource = restful.Resource('/', mock.MagicMock())

        with self.assertRaises(NotImplementedError) as e:
            resource.add_to_app(self.app)

        self.assertEqual(
            str(e.exception),
            'restful_api not passed to add_to_app, did you add it to '
            'via.init_app?')

    def test_add_to_app(self):

        api = mock.MagicMock()

        class Resource(mock.MagicMock):
            pass


# Path: flask_via/routers/restful.py
# class Resource(BaseRouter):
#     def __init__(self, url, resource, endpoint=None):
#     def add_to_app(self, app, **kwargs):


# Path: tests/test_routers/test_restful.py
import mock
import unittest
from flask_via.routers import restful

Unit tests for the Flask-Restful resource router.
"""




class TestRestfulRouter(unittest.TestCase):

    def setUp(self):
        self.app = mock.MagicMock()

    def test_add_to_app_raises_not_implemented(self):

        resource = restful.Resource('/', mock.MagicMock())

        with self.assertRaises(NotImplementedError) as e:
            resource.add_to_app(self.app)

        self.assertEqual(
            str(e.exception),
            'restful_api not passed to add_to_app, did you add it to '
            'via.init_app?')

    def test_add_to_app(self):

        api = mock.MagicMock()

        class Resource(mock.MagicMock):
            pass


        resource = restful.Resource('/', Resource)