Skip to content

Commit 119690d

Browse files
committed
feat: prepare "contrib" area
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent bd37a9e commit 119690d

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

tests/test_deserialize_json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class TestDeserializeJson(TestCase, SnapshotMixin, DeepCompareMixin):
4343

4444
@named_data(*all_get_bom_funct_valid_immut,
4545
*all_get_bom_funct_valid_reversible_migrate)
46-
@patch('cyclonedx.builder.this.__ThisVersion', 'TESTING')
46+
@patch('cyclonedx.contrib.this.builders.__ThisVersion', 'TESTING')
4747
def test_prepared(self, get_bom: Callable[[], Bom], *_: Any, **__: Any) -> None:
4848
# only latest schema will have all data populated in serialized form
4949
snapshot_name = mksname(get_bom, _LATEST_SCHEMA, OutputFormat.JSON)

tests/test_deserialize_xml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class TestDeserializeXml(TestCase, SnapshotMixin, DeepCompareMixin):
4040

4141
@named_data(*all_get_bom_funct_valid_immut,
4242
*all_get_bom_funct_valid_reversible_migrate)
43-
@patch('cyclonedx.builder.this.__ThisVersion', 'TESTING')
43+
@patch('cyclonedx.contrib.this.builders.__ThisVersion', 'TESTING')
4444
def test_prepared(self, get_bom: Callable[[], Bom], *_: Any, **__: Any) -> None:
4545
# only latest schema will have all data populated in serialized form
4646
snapshot_name = mksname(get_bom, _LATEST_SCHEMA, OutputFormat.XML)

tests/test_factory_license.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ def test_make_from_string_with_id(self) -> None:
3232
acknowledgement = unittest.mock.NonCallableMock(spec=LicenseAcknowledgement)
3333
expected = DisjunctiveLicense(id='bar', text=text, url=url, acknowledgement=acknowledgement)
3434

35-
with unittest.mock.patch('cyclonedx.factory.license.spdx_fixup', return_value='bar'), \
36-
unittest.mock.patch('cyclonedx.factory.license.is_spdx_expression', return_value=True):
35+
with unittest.mock.patch('cyclonedx.contrib.license.factories.spdx_fixup', return_value='bar'), \
36+
unittest.mock.patch('cyclonedx.contrib.license.factories.is_spdx_expression', return_value=True):
3737
actual = LicenseFactory().make_from_string('foo',
3838
license_text=text,
3939
license_url=url,
@@ -47,8 +47,8 @@ def test_make_from_string_with_name(self) -> None:
4747
acknowledgement = unittest.mock.NonCallableMock(spec=LicenseAcknowledgement)
4848
expected = DisjunctiveLicense(name='foo', text=text, url=url, acknowledgement=acknowledgement)
4949

50-
with unittest.mock.patch('cyclonedx.factory.license.spdx_fixup', return_value=None), \
51-
unittest.mock.patch('cyclonedx.factory.license.is_spdx_expression', return_value=False):
50+
with unittest.mock.patch('cyclonedx.contrib.license.factories.spdx_fixup', return_value=None), \
51+
unittest.mock.patch('cyclonedx.contrib.license.factories.is_spdx_expression', return_value=False):
5252
actual = LicenseFactory().make_from_string('foo',
5353
license_text=text,
5454
license_url=url,
@@ -60,8 +60,8 @@ def test_make_from_string_with_expression(self) -> None:
6060
acknowledgement = unittest.mock.NonCallableMock(spec=LicenseAcknowledgement)
6161
expected = LicenseExpression('foo', acknowledgement=acknowledgement)
6262

63-
with unittest.mock.patch('cyclonedx.factory.license.spdx_fixup', return_value=None), \
64-
unittest.mock.patch('cyclonedx.factory.license.is_spdx_expression', return_value=True):
63+
with unittest.mock.patch('cyclonedx.contrib.license.factories.spdx_fixup', return_value=None), \
64+
unittest.mock.patch('cyclonedx.contrib.license.factories.is_spdx_expression', return_value=True):
6565
actual = LicenseFactory().make_from_string('foo',
6666
license_acknowledgement=acknowledgement)
6767

@@ -73,14 +73,14 @@ def test_make_with_id(self) -> None:
7373
acknowledgement = unittest.mock.NonCallableMock(spec=LicenseAcknowledgement)
7474
expected = DisjunctiveLicense(id='bar', text=text, url=url, acknowledgement=acknowledgement)
7575

76-
with unittest.mock.patch('cyclonedx.factory.license.spdx_fixup', return_value='bar'):
76+
with unittest.mock.patch('cyclonedx.contrib.license.factories.spdx_fixup', return_value='bar'):
7777
actual = LicenseFactory().make_with_id(spdx_id='foo', text=text, url=url, acknowledgement=acknowledgement)
7878

7979
self.assertEqual(expected, actual)
8080

8181
def test_make_with_id_raises(self) -> None:
8282
with self.assertRaises(InvalidSpdxLicenseException, msg='foo'):
83-
with unittest.mock.patch('cyclonedx.factory.license.spdx_fixup', return_value=None):
83+
with unittest.mock.patch('cyclonedx.contrib.license.factories.spdx_fixup', return_value=None):
8484
LicenseFactory().make_with_id(spdx_id='foo')
8585

8686
def test_make_with_name(self) -> None:
@@ -94,11 +94,11 @@ def test_make_with_name(self) -> None:
9494
def test_make_with_expression(self) -> None:
9595
acknowledgement = unittest.mock.NonCallableMock(spec=LicenseAcknowledgement)
9696
expected = LicenseExpression('foo', acknowledgement=acknowledgement)
97-
with unittest.mock.patch('cyclonedx.factory.license.is_spdx_expression', return_value=True):
97+
with unittest.mock.patch('cyclonedx.contrib.license.factories.is_spdx_expression', return_value=True):
9898
actual = LicenseFactory().make_with_expression(expression='foo', acknowledgement=acknowledgement)
9999
self.assertEqual(expected, actual)
100100

101101
def test_make_with_expression_raises(self) -> None:
102102
with self.assertRaises(InvalidLicenseExpressionException, msg='foo'):
103-
with unittest.mock.patch('cyclonedx.factory.license.is_spdx_expression', return_value=False):
103+
with unittest.mock.patch('cyclonedx.contrib.license.factories.is_spdx_expression', return_value=False):
104104
LicenseFactory().make_with_expression('foo')

tests/test_output_json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def test_unsupported_schema_raises(self, sv: SchemaVersion) -> None:
6262
and is_valid_for_schema_version(gb, sv)
6363
))
6464
@unpack
65-
@patch('cyclonedx.builder.this.__ThisVersion', 'TESTING')
65+
@patch('cyclonedx.contrib.this.builders.__ThisVersion', 'TESTING')
6666
def test_valid(self, get_bom: Callable[[], Bom], sv: SchemaVersion, *_: Any, **__: Any) -> None:
6767
snapshot_name = mksname(get_bom, sv, OutputFormat.JSON)
6868
bom = get_bom()

tests/test_output_xml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class TestOutputXml(TestCase, SnapshotMixin):
4949
if is_valid_for_schema_version(gb, sv)
5050
))
5151
@unpack
52-
@patch('cyclonedx.builder.this.__ThisVersion', 'TESTING')
52+
@patch('cyclonedx.contrib.this.builders.__ThisVersion', 'TESTING')
5353
def test_valid(self, get_bom: Callable[[], Bom], sv: SchemaVersion, *_: Any, **__: Any) -> None:
5454
snapshot_name = mksname(get_bom, sv, OutputFormat.XML)
5555
if snapshot_name is None:

tests/test_real_world_examples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from tests import OWN_DATA_DIRECTORY
2727

2828

29-
@patch('cyclonedx.builder.this.__ThisVersion', 'TESTING')
29+
@patch('cyclonedx.contrib.this.builders.__ThisVersion', 'TESTING')
3030
@patch('cyclonedx.model.bom._get_now_utc', return_value=datetime.fromisoformat('2023-01-07 13:44:32.312678+00:00'))
3131
class TestDeserializeRealWorldExamples(unittest.TestCase):
3232

0 commit comments

Comments
 (0)