Example #1
0
    def test_ts_tz_resolves(self):
        root = utils.get_etree_root(StringIO(TS_TZ_RESOLVES))

        offset_resolves = common.idref_timestamp_resolves(
            root=root,
            idref="example:campaign-1",
            timestamp="2015-04-14T15:24:19.416203+00:00",
            namespaces=common.get_stix_namespaces('1.1.1'))

        zulu_resolves = common.idref_timestamp_resolves(
            root=root,
            idref="example:campaign-1",
            timestamp="2015-04-14T15:24:19.416203Z",
            namespaces=common.get_stix_namespaces('1.1.1'))

        self.assertTrue(zulu_resolves)
        self.assertTrue(offset_resolves)
    def test_ts_tz_resolves(self):
        root = utils.get_etree_root(StringIO(TS_TZ_RESOLVES))

        offset_resolves = common.idref_timestamp_resolves(
            root=root,
            idref="example:campaign-1",
            timestamp="2015-04-14T15:24:19.416203+00:00",
            namespaces=common.get_stix_namespaces('1.1.1')
        )

        zulu_resolves = common.idref_timestamp_resolves(
            root=root,
            idref="example:campaign-1",
            timestamp="2015-04-14T15:24:19.416203Z",
            namespaces=common.get_stix_namespaces('1.1.1')
        )

        self.assertTrue(zulu_resolves)
        self.assertTrue(offset_resolves)
Example #3
0
    def test_ts_not_resolves(self):
        sio = StringIO(TS_DOES_NOT_RESOLVE)

        idref = "example:campaign-1"
        timestamp = "2015-04-14T15:24:19.416203+00:00"

        resolves = common.idref_timestamp_resolves(
            root=sio,
            idref=idref,
            timestamp=timestamp,
            namespaces=common.get_stix_namespaces('1.1.1'))

        self.assertEqual(resolves, False)
    def test_ts_not_resolves(self):
        sio = StringIO(TS_DOES_NOT_RESOLVE)

        idref = "example:campaign-1"
        timestamp="2015-04-14T15:24:19.416203+00:00"

        resolves = common.idref_timestamp_resolves(
            root=sio,
            idref=idref,
            timestamp=timestamp,
            namespaces=common.get_stix_namespaces('1.1.1')
        )

        self.assertEqual(resolves, False)