Skip to content

Commit

Permalink
Restrict new unit testing to modern API
Browse files Browse the repository at this point in the history
  • Loading branch information
SchrodingersGat committed May 11, 2024
1 parent 6ad4645 commit b33e77f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/test_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from test_api import InvenTreeTestCase # noqa: E402

from inventree.label import LabelTemplate # noqa: E402
from inventree.label import MODERN_LABEL_PRINTING_API # noqa: E402
from inventree.part import Part # noqa: E402
from inventree.plugin import InvenTreePlugin # noqa: E402

Expand All @@ -18,6 +19,10 @@ class LabelTemplateTests(InvenTreeTestCase):
def test_label_template_list(self):
"""List available label templates."""

# Test only for the modern API
if self.api.api_version < MODERN_LABEL_PRINTING_API:
return

n = LabelTemplate.count(self.api)
templates = LabelTemplate.list(self.api)

Expand Down Expand Up @@ -48,6 +53,10 @@ def test_label_template_list(self):
def test_label_print(self):
"""Print a template!"""

# Test only for the modern API
if self.api.api_version < MODERN_LABEL_PRINTING_API:
return

# Find a part to print
part = Part.list(self.api, limit=1)[0]

Expand Down
9 changes: 9 additions & 0 deletions test/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from inventree.build import Build # noqa: E402
from inventree.report import ReportTemplate # noqa: E402
from inventree.report import MODERN_LABEL_PRINTING_API # noqa: E402


class ReportClassesTest(InvenTreeTestCase):
Expand All @@ -17,6 +18,10 @@ class ReportClassesTest(InvenTreeTestCase):
def test_list_templates(self):
"""List the available report templates."""

# Test only for the modern API
if self.api.api_version < MODERN_LABEL_PRINTING_API:
return

templates = ReportTemplate.list(self.api)

self.assertGreater(len(templates), 0)
Expand All @@ -40,6 +45,10 @@ def test_list_templates(self):
def test_print_report(self):
"""Test report printing."""

# Test only for the modern API
if self.api.api_version < MODERN_LABEL_PRINTING_API:
return

# Find a build to print
build = Build.list(self.api, limit=1)[0]

Expand Down

0 comments on commit b33e77f

Please sign in to comment.