@@ -68,23 +68,13 @@ def test_tool_with_component_and_service_load_xml(self) -> None:
68
68
tuple (bom .metadata .tools .tools ),
69
69
tuple (expected .metadata .tools .tools ), 'tools' )
70
70
71
- def test_assign_component (self ) -> None :
72
- t = ToolsRepository ()
73
- t .components = SortedSet ([Component (name = 'test-component' )])
74
- s = t .components .pop ()
75
- self .assertEqual ('test-component' , s .name )
76
-
77
- def test_assign_service (self ) -> None :
78
- t = ToolsRepository ()
79
- t .services = SortedSet ([Service (name = 'test-service' )])
80
- s = t .services .pop ()
81
- self .assertEqual ('test-service' , s .name )
82
-
83
71
def test_invalid_tool_repo_properties (self ) -> None :
84
72
with self .assertRaises (MutuallyExclusivePropertiesException ):
85
73
ToolsRepository (
86
74
components = [Component (name = 'test-component' )],
87
- services = [Service (name = 'test-service' )], tools = [Tool ()])
75
+ services = [Service (name = 'test-service' )],
76
+ tools = [Tool (name = 'test-tool' )]
77
+ )
88
78
89
79
def test_assign_component_with_existing_tool (self ) -> None :
90
80
tr = ToolsRepository (tools = [Tool ()])
@@ -96,25 +86,42 @@ def test_assign_service_with_existing_tool(self) -> None:
96
86
with self .assertRaises (MutuallyExclusivePropertiesException ):
97
87
tr .services = SortedSet ([Service (name = 'test-service' )])
98
88
99
- def test_equal_other_objectd (self ) -> None :
89
+ def test_unequal_different_type (self ) -> None :
100
90
tr = ToolsRepository ()
101
91
self .assertFalse (tr == 'other' )
102
92
103
- def test_equal_object (self ) -> None :
93
+ def test_equal_self (self ) -> None :
104
94
tr = ToolsRepository ()
95
+ tr .tools .add (Tool (name = 'my-tool' ))
105
96
self .assertTrue (tr == tr )
106
97
98
+ def test_unequal (self ) -> None :
99
+ tr1 = ToolsRepository ()
100
+ tr1 .components .add (Component (name = 'my-component' ))
101
+ tr1 .services .add (Service (name = 'my-service' ))
102
+ tr1 .tools .add (Tool (name = 'my-tool' ))
103
+ tr2 = ToolsRepository ()
104
+ self .assertFalse (tr1 == tr2 )
105
+
106
+ def test_equal (self ) -> None :
107
+ c = Component (name = 'my-component' )
108
+ s = Service (name = 'my-service' )
109
+ t = Tool (name = 'my-tool' )
110
+ tr1 = ToolsRepository ()
111
+ tr1 .components .add (c )
112
+ tr1 .services .add (s )
113
+ tr1 .tools .add (t )
114
+ tr2 = ToolsRepository ()
115
+ tr2 .components .add (c )
116
+ tr2 .services .add (s )
117
+ tr2 .tools .add (t )
118
+ self .assertTrue (tr1 == tr2 )
119
+
107
120
def test_assign_tool_with_existing_component (self ) -> None :
108
121
tr = ToolsRepository (components = SortedSet ([Component (name = 'test-component' )]))
109
122
with self .assertRaises (MutuallyExclusivePropertiesException ):
110
123
tr .tools = SortedSet ([Tool ()])
111
124
112
- def test_assign_tool (self ) -> None :
113
- tr = ToolsRepository ()
114
- tr .tools = SortedSet ([Tool (name = 'test-tool' )])
115
- t = tr .tools .pop ()
116
- self .assertEqual ('test-tool' , t .name )
117
-
118
125
def test_proper_service_provider_conversion (self ) -> None :
119
126
o = OrganizationalEntity (name = 'test-org' )
120
127
s = Service (name = 'test-service' , provider = o )
0 commit comments