@@ -68,28 +68,6 @@ def test_stix21_bundle_with_grouping_description(self):
68
68
# MISP GALAXIES IMPORT TESTS #
69
69
############################################################################
70
70
71
- def _check_location_galaxy_features (
72
- self , galaxies , stix_object , galaxy_type , cluster_value = None ):
73
- self .assertEqual (len (galaxies ), 1 )
74
- galaxy = galaxies [0 ]
75
- self .assertEqual (len (galaxy .clusters ), 1 )
76
- cluster = galaxy .clusters [0 ]
77
- self ._assert_multiple_equal (galaxy .type , cluster .type , galaxy_type )
78
- self .assertEqual (
79
- galaxy .name , self ._galaxy_name_mapping (galaxy_type )['name' ]
80
- )
81
- self .assertEqual (
82
- galaxy .description ,
83
- self ._galaxy_name_mapping (galaxy_type )['description' ]
84
- )
85
- if cluster_value is None :
86
- self .assertEqual (cluster .value , stix_object .name )
87
- else :
88
- self .assertEqual (cluster .value , cluster_value )
89
- if hasattr (stix_object , 'description' ):
90
- self .assertEqual (cluster .description , stix_object .description )
91
- return cluster .meta
92
-
93
71
def test_stix21_bundle_with_attack_pattern_galaxy (self ):
94
72
bundle = TestExternalSTIX21Bundles .get_bundle_with_attack_pattern_galaxy ()
95
73
self .parser .load_stix_bundle (bundle )
@@ -178,18 +156,22 @@ def test_stix21_bundle_with_location_galaxy(self):
178
156
event = self .parser .misp_event
179
157
_ , grouping , event_location , indicator , attribute_location , _ = bundle .objects
180
158
self ._check_misp_event_features_from_grouping (event , grouping )
181
- country_meta = self ._check_location_galaxy_features (
182
- event .galaxies , event_location , 'country'
159
+ country_meta = self ._check_galaxy_features (
160
+ event .galaxies , event_location
183
161
)
184
- self .assertEqual (country_meta , {})
162
+ self .assertEqual (country_meta ['country' ], event_location .country )
163
+ self .assertEqual (country_meta ['region' ], event_location .region )
185
164
self .assertEqual (len (event .attributes ), 1 )
186
165
attribute = event .attributes [0 ]
187
166
self .assertEqual (attribute .uuid , indicator .id .split ('--' )[1 ])
188
- region_meta = self ._check_location_galaxy_features (
189
- attribute .galaxies , attribute_location , 'region' ,
190
- cluster_value = '154 - Northern Europe'
167
+ region_meta = self ._check_galaxy_features (
168
+ attribute .galaxies , attribute_location
169
+ )
170
+ self .assertEqual (
171
+ region_meta ['administrative_area' ],
172
+ attribute_location .administrative_area
191
173
)
192
- self .assertEqual (region_meta , {} )
174
+ self .assertEqual (region_meta [ 'country' ], attribute_location . country )
193
175
194
176
def test_stix21_bundle_with_malware_galaxy (self ):
195
177
bundle = TestExternalSTIX21Bundles .get_bundle_with_malware_galaxy ()
0 commit comments