from noopy.endpoint import methods
from noopy.endpoint.decorators import endpoint


@endpoint('/foo', methods.GET)
def sample_view(event, context):
    pass


def test_resources_added():
    from noopy.endpoint.resource import Resource

    resources = Resource.resources
    assert set(resources.keys()) == {'/', '/foo'}
    assert resources['/'].children == [resources['/foo']]
    assert resources['/foo'].parent == resources['/']


def test_endpoints_added():
    from noopy.endpoint import Endpoint

    endpoints = Endpoint.endpoints
    assert set(endpoints.keys()) == {('/foo', methods.GET)}

@@ -541,60 +541,150 @@
     
-assert set(endpoints.keys()) == %7B('/foo', methods.GET)%7D
+foo_endpoint = Endpoint('/foo', methods.GET)%0A    assert set(endpoints.keys()) == %7Bfoo_endpoint%7D%0A    assert endpoints%5Bfoo_endpoint%5D == sample_view
 %0A

Test Endpoint.endpoints has all endpoints