From 99b3ca9b64011090c11bc49c7f28602732e3b8f7 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste <bleme@pm.me> Date: Tue, 19 Feb 2019 16:18:33 +0100 Subject: [PATCH] syntax: add skipped test for the future "auto urls" feature --- djangoldp/tests/runner.py | 2 +- .../{tests_resolver.py => tests_ldp_model.py} | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) rename djangoldp/tests/{tests_resolver.py => tests_ldp_model.py} (64%) diff --git a/djangoldp/tests/runner.py b/djangoldp/tests/runner.py index 17419667..4e3bcd04 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 96b1be0f..0bf48e49 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()) -- GitLab