2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 11:10:54 +00:00

[FR]Unit test for Schema allowance (#3538)

* [FR]Unit test for Schema allowance
Fixes #3420

* move schema loding into a runtime obj
This commit is contained in:
Matthias Mair
2022-10-18 00:38:43 +02:00
committed by GitHub
parent c1064906d6
commit 9cfbe1061d
3 changed files with 21 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import datetime
from django.core.exceptions import ValidationError
from django.db.models import Sum
from django.test import override_settings
from build.models import Build
from InvenTree.helpers import InvenTreeTestCase
@ -140,7 +141,7 @@ class StockTest(StockTestBase):
item.save()
item.full_clean()
# Check that valid URLs pass
# Check that valid URLs pass - and check custon schemes
for good_url in [
'https://test.com',
'https://digikey.com/datasheets?file=1010101010101.bin',
@ -163,6 +164,14 @@ class StockTest(StockTestBase):
item.link = long_url
item.save()
@override_settings(EXTRA_URL_SCHEMES=['ssh'])
def test_exteneded_schema(self):
"""Test that extended URL schemes are allowed"""
item = StockItem.objects.get(pk=1)
item.link = 'ssh://user:pwd@deb.org:223'
item.save()
item.full_clean()
def test_expiry(self):
"""Test expiry date functionality for StockItem model."""
today = datetime.datetime.now().date()