mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 04:55:44 +00:00
Seperate CUI url paths and tests (#6543)
* move CUI JS files to CUI url section * add flag to seperate CUI code and tests * re-enable tests * move urls back to backend patterns * swap switch logic * fix merge * returning PUI paths if CUI not enabled * revert test changes * fix plugin settings url * URL is not dependant on UI generation * small fixes Co-authored-by: Oliver <oliver.henry.walters@gmail.com> --------- Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
@ -4,6 +4,7 @@ import decimal
|
||||
import logging
|
||||
import os
|
||||
from datetime import datetime
|
||||
from django.conf import settings
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.exceptions import ValidationError
|
||||
@ -161,7 +162,9 @@ class Build(InvenTree.models.InvenTreeBarcodeMixin, InvenTree.models.InvenTreeNo
|
||||
|
||||
def get_absolute_url(self):
|
||||
"""Return the web URL associated with this BuildOrder"""
|
||||
return reverse('build-detail', kwargs={'pk': self.id})
|
||||
if settings.ENABLE_CLASSIC_FRONTEND:
|
||||
return reverse('build-detail', kwargs={'pk': self.id})
|
||||
return InvenTree.helpers.pui_url(f'/build/{self.id}')
|
||||
|
||||
reference = models.CharField(
|
||||
unique=True,
|
||||
|
@ -1,5 +1,7 @@
|
||||
"""Basic unit tests for the BuildOrder app"""
|
||||
|
||||
from django.conf import settings
|
||||
from django.test import tag
|
||||
from django.urls import reverse
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
@ -40,7 +42,8 @@ class BuildTestSimple(InvenTreeTestCase):
|
||||
def test_url(self):
|
||||
"""Test URL lookup"""
|
||||
b1 = Build.objects.get(pk=1)
|
||||
self.assertEqual(b1.get_absolute_url(), '/build/1/')
|
||||
if settings.ENABLE_CLASSIC_FRONTEND:
|
||||
self.assertEqual(b1.get_absolute_url(), '/build/1/')
|
||||
|
||||
def test_is_complete(self):
|
||||
"""Test build completion status"""
|
||||
@ -116,11 +119,13 @@ class TestBuildViews(InvenTreeTestCase):
|
||||
is_building=True,
|
||||
)
|
||||
|
||||
@tag('cui')
|
||||
def test_build_index(self):
|
||||
"""Test build index view."""
|
||||
response = self.client.get(reverse('build-index'))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
@tag('cui')
|
||||
def test_build_detail(self):
|
||||
"""Test the detail view for a Build object."""
|
||||
pk = 1
|
||||
|
Reference in New Issue
Block a user