2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-09-15 15:11:34 +00:00
This commit is contained in:
Matthias Mair
2025-02-05 23:40:02 +01:00
parent 0d271a9944
commit 60f0d8c133

View File

@@ -2,7 +2,7 @@
from base64 import b64encode from base64 import b64encode
from pathlib import Path from pathlib import Path
from tempfile import NamedTemporaryFile from tempfile import TemporaryDirectory
from django.urls import reverse from django.urls import reverse
@@ -468,12 +468,13 @@ class GeneralApiTests(InvenTreeAPITestCase):
self.assertIn('License file not found at', str(log.output)) self.assertIn('License file not found at', str(log.output))
with NamedTemporaryFile('w', encoding='utf8') as sample_file: with TemporaryDirectory() as tmp:
sample_file.write('abc') sample_file = Path(tmp, 'temp.txt')
sample_file.write_text('abc')
# File is not a json # File is not a json
with self.assertLogs(logger='inventree', level='ERROR') as log: with self.assertLogs(logger='inventree', level='ERROR') as log:
respo = read_license_file(Path(str(sample_file.file.name))) respo = read_license_file(sample_file)
self.assertEqual(respo, []) self.assertEqual(respo, [])
self.assertIn('Failed to parse license file', str(log.output)) self.assertIn('Failed to parse license file', str(log.output))