Skip to content

Commit

Permalink
Updated unit tests to align with new VocabString dict representation
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Worrell committed Apr 28, 2014
1 parent 1be56a4 commit c8f53ac
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 176 deletions.
12 changes: 6 additions & 6 deletions stix/test/campaign_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CampaignTest(EntityTestCase, unittest.TestCase):
'scope': "exclusive",
'ttps': [
{
'confidence': {'value': "High"},
'confidence': {'value': {'value': "Medium", 'xsi:type':'stixVocabs:HighMediumLowVocab-1.0'}},
'ttp': {'title': "Stealth", 'version': "1.1"},
}
]
Expand All @@ -43,7 +43,7 @@ class CampaignTest(EntityTestCase, unittest.TestCase):
'scope': "inclusive",
'incidents': [
{
'confidence': {'value': "Low"},
'confidence': {'value': {'value': "Medium", 'xsi:type':'stixVocabs:HighMediumLowVocab-1.0'}},
'incident': {'idref': "example:Incident-2",
'version': "1.1"},
}
Expand All @@ -53,7 +53,7 @@ class CampaignTest(EntityTestCase, unittest.TestCase):
'scope': "inclusive",
'indicators': [
{
'confidence': {'value': "Low"},
'confidence': {'value': {'value': "Medium", 'xsi:type':'stixVocabs:HighMediumLowVocab-1.0'}},
'indicator': {'idref': "example:Indicator-77",
'version': "2.1"},
}
Expand All @@ -63,7 +63,7 @@ class CampaignTest(EntityTestCase, unittest.TestCase):
'scope': "inclusive",
'threat_actors': [
{
'confidence': {'value': "Low"},
'confidence': {'value': {'value': "Medium", 'xsi:type':'stixVocabs:HighMediumLowVocab-1.0'}},
'threat_actor': {'title': "Campaign Actor #1",
'version': "1.1"},
},
Expand All @@ -77,13 +77,13 @@ class CampaignTest(EntityTestCase, unittest.TestCase):
'scope': "inclusive",
'campaigns': [
{
'confidence': {'value': "High"},
'confidence': {'value': {'value': "Medium", 'xsi:type':'stixVocabs:HighMediumLowVocab-1.0'}},
'information_source': {'description': "Threat Feed"},
'campaign': {'title': "Baby Elephant", 'version': "1.1"},
}
],
},
'confidence': {"value": "Low"},
'confidence': {'value': {'value': "Medium", 'xsi:type':'stixVocabs:HighMediumLowVocab-1.0'}},
'activity': [
{
'date_time': "2012-01-01T08:45:31",
Expand Down
12 changes: 6 additions & 6 deletions stix/test/coa_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ class COATests(EntityTestCase, unittest.TestCase):
'timestamp': "2014-03-20T04:35:12",
'version': '1.1',
'title': "COA1",
'stage': "Remedy",
'type': "Redirection",
'stage': {'value': 'Remedy', 'xsi:type': 'stixVocabs:COAStageVocab-1.0'},
'type': {'value': 'Redirection', 'xsi:type': 'stixVocabs:CourseOfActionTypeVocab-1.0'},
'description': "This is a long description about a course of action",
'short_description': "a COA",
'objective': {
'description': "This is why we're taking this action",
'short_description': "Stop the bad stuff",
'applicability_confidence': {
'value': "Medium"
},
'applicability_confidence': {'value': {'value': 'Medium',
'xsi:type': 'stixVocabs:HighMediumLowVocab-1.0'}},

},
'parameter_observables': {
'major_version': 2,
Expand Down Expand Up @@ -58,7 +58,7 @@ class COATests(EntityTestCase, unittest.TestCase):
'scope': "exclusive",
'coas': [
{
'confidence': {'value': "Medium"},
'confidence': {'value': {'value': "Medium", 'xsi:type':'stixVocabs:HighMediumLowVocab-1.0'}},
'course_of_action': {'idref': "example:COA-52",
'version': "2.1"},
}
Expand Down
2 changes: 1 addition & 1 deletion stix/test/common/confidence_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ConfidenceTests(EntityTestCase, unittest.TestCase):
_full_dict = {
'timestamp': "2014-01-31T06:14:46",
'timestamp_precision': 'day',
'value': "High",
'value': {'value': "High", 'xsi:type':'stixVocabs:HighMediumLowVocab-1.0'},
'description': "An amazing source",
'source': "a source",
}
Expand Down
2 changes: 1 addition & 1 deletion stix/test/common/identity_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class IdentityTests(EntityTestCase, unittest.TestCase):
#'scope': 'inclusive',
'identities': [
{
'confidence': {'value': "Medium"},
'confidence': {'value': {'value': "Medium", 'xsi:type':'stixVocabs:HighMediumLowVocab-1.0'}},
'identity': {'id': "foo2"}
}
]
Expand Down
4 changes: 1 addition & 3 deletions stix/test/common/related_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ class StatementTests(EntityTestCase, unittest.TestCase):
_full_dict = {
'idref': "example:Campaign-133",
'timestamp': "2014-01-31T06:14:46",
'confidence': {
'value': "Low",
},
'confidence': {'value': {'value': "Medium", 'xsi:type':'stixVocabs:HighMediumLowVocab-1.0'}},
'information_source': {
'description': "Source of the relationship",
},
Expand Down
2 changes: 1 addition & 1 deletion stix/test/common/statement_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class StatementTests(EntityTestCase, unittest.TestCase):
'description': "An amazing source",
'source': "a source",
'confidence': {
'value': "Low",
'value': {'value': "Low", 'xsi:type':'stixVocabs:HighMediumLowVocab-1.0'},
},
}

Expand Down
16 changes: 8 additions & 8 deletions stix/test/core/stix_package_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class STIXPackageTests(EntityTestCase, unittest.TestCase):
'scope': "exclusive",
'ttps': [
{
'confidence': {'value': "High"},
'confidence': {'value': {'value': "Medium", 'xsi:type':'stixVocabs:HighMediumLowVocab-1.0'}},
'ttp': {'title': "Stealth", 'version': "1.1"},
}
]
Expand All @@ -79,7 +79,7 @@ class STIXPackageTests(EntityTestCase, unittest.TestCase):
'scope': "inclusive",
'incidents': [
{
'confidence': {'value': "Low"},
'confidence': {'value': {'value': "Medium", 'xsi:type':'stixVocabs:HighMediumLowVocab-1.0'}},
'incident': {'idref': "example:Incident-2",
'version': "1.1"},
}
Expand All @@ -89,7 +89,7 @@ class STIXPackageTests(EntityTestCase, unittest.TestCase):
'scope': "inclusive",
'indicators': [
{
'confidence': {'value': "Low"},
'confidence': {'value': {'value': "Medium", 'xsi:type':'stixVocabs:HighMediumLowVocab-1.0'}},
'indicator': {'idref': "example:Indicator-77",
'version': "2.1"},
}
Expand All @@ -99,7 +99,7 @@ class STIXPackageTests(EntityTestCase, unittest.TestCase):
'scope': "inclusive",
'threat_actors': [
{
'confidence': {'value': "Low"},
'confidence': {'value': {'value': "Medium", 'xsi:type':'stixVocabs:HighMediumLowVocab-1.0'}},
'threat_actor': {'title': "Campaign Actor #1",
'version': "1.1"},
},
Expand All @@ -113,13 +113,13 @@ class STIXPackageTests(EntityTestCase, unittest.TestCase):
'scope': "inclusive",
'campaigns': [
{
'confidence': {'value': "High"},
'confidence': {'value': {'value': "Medium", 'xsi:type':'stixVocabs:HighMediumLowVocab-1.0'}},
'information_source': {'description': "Threat Feed"},
'campaign': {'title': "Baby Elephant", 'version': "1.1"},
}
],
},
'confidence': {"value": "Low"},
'confidence': {'value': {'value': "Medium", 'xsi:type':'stixVocabs:HighMediumLowVocab-1.0'}},
'activity': [
{
'date_time': "2012-01-01T08:45:31",
Expand Down Expand Up @@ -161,8 +161,8 @@ class STIXPackageTests(EntityTestCase, unittest.TestCase):
'title': "COA1",
'description': "This is a long description about a course of action",
'short_description': "a COA",
'stage': "Remedy",
'type': "Redirection",
'stage': {"value" : "Remedy", "xsi:type" : "stixVocabs:COAStageVocab-1.0"},
'type': {'value': 'Redirection','xsi:type': 'stixVocabs:CourseOfActionTypeVocab-1.0'},
'cost': {
'value': "100"
},
Expand Down
4 changes: 2 additions & 2 deletions stix/test/exploit_target_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ExploitTargetTests(EntityTestCase, unittest.TestCase):
'observable': {
'title': "Observable for some software"
},
'confidence': {'value': "Low"}
'confidence': {'value': {'value': "Medium", 'xsi:type':'stixVocabs:HighMediumLowVocab-1.0'}}
}
]
},
Expand Down Expand Up @@ -83,7 +83,7 @@ class ExploitTargetTests(EntityTestCase, unittest.TestCase):
'id': 'example:coa-1',
'version': '1.1',
'timestamp': "2014-03-20T04:35:12",
'stage': "Remedy",
'stage': {'value': 'Remedy', 'xsi:type': 'stixVocabs:COAStageVocab-1.0'},
'cost': {
'value': "100"
},
Expand Down
Loading

0 comments on commit c8f53ac

Please sign in to comment.