Esempio n. 1
0
    def testRaisesWhenInitializedFromInvalidValues(self):
        with self.assertRaises(ValueError):
            hunt_plugin.ApiHuntId("blah")

        with self.assertRaises(ValueError):
            hunt_plugin.ApiHuntId("H:")

        with self.assertRaises(ValueError):
            hunt_plugin.ApiHuntId("1234")

        with self.assertRaises(ValueError):
            hunt_plugin.ApiHuntId("H:1234/foo")
Esempio n. 2
0
    def testConvertsToHunttURN(self):
        hunt_id = hunt_plugin.ApiHuntId("H:1234")
        hunt_urn = hunt_id.ToURN()

        self.assertEqual(hunt_urn.Basename(), hunt_id)
        self.assertEqual(hunt_urn, "aff4:/hunts/H:1234")
Esempio n. 3
0
 def testRaisesWhenToURNCalledOnUninitializedValue(self):
     hunt_id = hunt_plugin.ApiHuntId()
     with self.assertRaises(ValueError):
         hunt_id.ToURN()
Esempio n. 4
0
 def GenerateSample(self, number=0):
     return hunt_plugin.ApiHuntId("H:%d" % number)