<s> import copy <EOL> import StringIO <EOL> import unittest <EOL> from stix . test import EntityTestCase , assert_warnings <EOL> from stix . test import report_test <EOL> from stix . test . common import kill_chains_test , related_test <EOL> from . import stix_header_test <EOL> from stix import core <EOL> from stix . core import stix_package <EOL> from stix . campaign import Campaign <EOL> from stix . coa import CourseOfAction <EOL> from stix . exploit_target import ExploitTarget <EOL> from stix . indicator import Indicator <EOL> from stix . incident import Incident <EOL> from stix . threat_actor import ThreatActor <EOL> from stix . ttp import TTP <EOL> from stix . utils import silence_warnings , now <EOL> class CampaignsTests ( EntityTestCase , unittest . TestCase ) : <EOL> klass = stix_package . Campaigns <EOL> _full_dict = [ <EOL> { '<STR_LIT>' : '<STR_LIT>' } <EOL> ] <EOL> class COAsTests ( EntityTestCase , unittest . TestCase ) : <EOL> klass = stix_package . CoursesOfAction <EOL> _full_dict = [ <EOL> { '<STR_LIT>' : '<STR_LIT>' } <EOL> ] <EOL> class ExploitTargetsTests ( EntityTestCase , unittest . TestCase ) : <EOL> klass = stix_package . ExploitTargets <EOL> _full_dict = [ <EOL> { '<STR_LIT>' : '<STR_LIT>' } <EOL> ] <EOL> class IncidentsTests ( EntityTestCase , unittest . TestCase ) : <EOL> klass = stix_package . Incidents <EOL> _full_dict = [ <EOL> { '<STR_LIT>' : '<STR_LIT>' } <EOL> ] <EOL> class IndicatorsTests ( EntityTestCase , unittest . TestCase ) : <EOL> klass = stix_package . Indicators <EOL> _full_dict = [ <EOL> { '<STR_LIT>' : '<STR_LIT>' } <EOL> ] <EOL> class ThreatActorsTests ( EntityTestCase , unittest . TestCase ) : <EOL> klass = stix_package . ThreatActors <EOL> _full_dict = [ <EOL> { '<STR_LIT>' : '<STR_LIT>' } <EOL> ] <EOL> class TTPsTests ( EntityTestCase , unittest . TestCase ) : <EOL> klass = stix_package . TTPs <EOL> _full_dict = { <EOL> '<STR_LIT>' : kill_chains_test . KillChainsTests . _full_dict , <EOL> '<STR_LIT>' : [ <EOL> { '<STR_LIT>' : '<STR_LIT>' } <EOL> ] <EOL> } <EOL> class ReportsTests ( EntityTestCase , unittest . TestCase ) : <EOL> klass = stix_package . Reports <EOL> _full_dict = [ <EOL> report_test . ReportTests . _full_dict <EOL> ] <EOL> class STIXPackageTests ( EntityTestCase , unittest . TestCase ) : <EOL> klass = core . STIXPackage <EOL> _full_dict = { <EOL> '<STR_LIT>' : stix_header_test . STIXHeaderTests . _full_dict , <EOL> '<STR_LIT>' : CampaignsTests . _full_dict , <EOL> '<STR_LIT>' : COAsTests . _full_dict , <EOL> '<STR_LIT>' : ExploitTargetsTests . _full_dict , <EOL> '<STR_LIT>' : IncidentsTests . _full_dict , <EOL> '<STR_LIT>' : IndicatorsTests . _full_dict , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : <NUM_LIT:2> , <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT>' : <NUM_LIT:0> , <EOL> '<STR_LIT>' : [ <EOL> { <EOL> '<STR_LIT>' : "<STR_LIT>" <EOL> } <EOL> ] <EOL> } , <EOL> '<STR_LIT>' : ThreatActorsTests . _full_dict , <EOL> '<STR_LIT>' : TTPsTests . _full_dict , <EOL> '<STR_LIT>' : related_test . RelatedPackagesTests . _full_dict , <EOL> '<STR_LIT>' : ReportsTests . _full_dict , <EOL> '<STR_LIT:version>' : "<STR_LIT>" <EOL> } <EOL> @ silence_warnings <EOL> def test_deepcopy ( self ) : <EOL> """<STR_LIT>""" <EOL> package = core . STIXPackage . from_xml ( <EOL> StringIO . StringIO ( <EOL> core . STIXPackage ( ) . to_xml ( ) <EOL> ) <EOL> ) <EOL> copied = copy . deepcopy ( package ) <EOL> self . assertEqual ( package . timestamp , copied . timestamp ) <EOL> @ assert_warnings <EOL> def test_deprecated_idref ( self ) : <EOL> p = core . STIXPackage ( ) <EOL> p . idref = "<STR_LIT:test>" <EOL> self . assertEqual ( p . idref , "<STR_LIT:test>" ) <EOL> @ assert_warnings <EOL> def test_deprecated_timestamp ( self ) : <EOL> p = core . STIXPackage ( ) <EOL> ts = now ( ) <EOL> p . timestamp = ts <EOL> self . assertEqual ( ts , p . timestamp ) <EOL> @ assert_warnings <EOL> def test_campaign_idref_deprecation ( self ) : <EOL> package = core . STIXPackage ( ) <EOL> package . add ( Campaign ( idref = '<STR_LIT>' ) ) <EOL> @ assert_warnings <EOL> def test_coa_idref_deprecation ( self ) : <EOL> package = core . STIXPackage ( ) <EOL> package . add ( CourseOfAction ( idref = '<STR_LIT>' ) ) <EOL> @ assert_warnings <EOL> def test_et_idref_deprecation ( self ) : <EOL> package = core . STIXPackage ( ) <EOL> package . add ( ExploitTarget ( idref = '<STR_LIT>' ) ) <EOL> @ assert_warnings <EOL> def test_incident_idref_deprecation ( self ) : <EOL> package = core . STIXPackage ( ) <EOL> package . add ( Incident ( idref = '<STR_LIT>' ) ) <EOL> @ assert_warnings <EOL> def test_indicator_idref_deprecation ( self ) : <EOL> package = core . STIXPackage ( ) <EOL> package . add ( Indicator ( idref = '<STR_LIT>' ) ) <EOL> @ assert_warnings <EOL> def test_ta_idref_deprecation ( self ) : <EOL> package = core . STIXPackage ( ) <EOL> package . add ( ThreatActor ( idref = '<STR_LIT>' ) ) <EOL> @ assert_warnings <EOL> def test_ttp_idref_deprecation ( self ) : <EOL> package = core . STIXPackage ( ) <EOL> package . add ( TTP ( idref = '<STR_LIT>' ) ) <EOL> @ assert_warnings <EOL> def test_related_package_idref_deprecation ( self ) : <EOL> package = core . STIXPackage ( ) <EOL> package . add_related_package ( core . STIXPackage ( idref = '<STR_LIT:foo>' ) ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
