diff --git a/djangoldp/tests/runner.py b/djangoldp/tests/runner.py index 17419667e78c5a00b4e1f71dba2c0b47f5aaa88f..4e3bcd0417a8ea9e8588f2ec0ae9539615278bb8 100644 --- a/djangoldp/tests/runner.py +++ b/djangoldp/tests/runner.py @@ -25,7 +25,7 @@ from django.test.runner import DiscoverRunner test_runner = DiscoverRunner(verbosity=1) failures = test_runner.run_tests([ - 'djangoldp.tests.tests_resolver', + 'djangoldp.tests.tests_ldp_model', 'djangoldp.tests.tests_save', 'djangoldp.tests.tests_update']) if failures: diff --git a/djangoldp/tests/tests_resolver.py b/djangoldp/tests/tests_ldp_model.py similarity index 64% rename from djangoldp/tests/tests_resolver.py rename to djangoldp/tests/tests_ldp_model.py index 96b1be0f91f9dcb5c77e9e48b2a3d5f4425f828b..0bf48e49369e5d0cad5761e7d324c91f0c0da413 100644 --- a/djangoldp/tests/tests_resolver.py +++ b/djangoldp/tests/tests_ldp_model.py @@ -1,10 +1,12 @@ +import unittest + from django.test import TestCase from djangoldp.models import LDPModel from djangoldp.tests.models import Dummy, LDPDummy -class UrlUtils(TestCase): +class LDPModelTest(TestCase): def test_class_not_inheriting_ldp_model(self): dummy = Dummy.objects.create(some="text") @@ -17,3 +19,13 @@ class UrlUtils(TestCase): self.assertEquals("/ldp-dummys/{}".format(dummy.pk), dummy.get_resource_path()) self.assertEquals("/ldp-dummys/", LDPModel.container_path(dummy)) self.assertEquals("/ldp-dummys/{}".format(dummy.pk), LDPModel.resource_path(dummy)) + + + @unittest.skip("futur feature: avoid urls.py on apps") + def test_auto_url(self): + from django.urls import get_resolver + dummy = LDPDummy.objects.create(some="text") + view_name = '{}-list'.format(dummy._meta.object_name.lower()) + path = '/{}'.format(get_resolver().reverse_dict[view_name][0][0][0], dummy.pk) + + self.assertEquals(path, dummy.get_resource_path())