def test_validates(self): """ Should validate if there is a valid instruction and name. """ doc = InstructionDocument(creator_id=self.cid, name='name',instruction={"load":"google.com"}) doc.validate()
def test_requires_valid_instruction(self): """ Should not validate without valid instruction. """ doc = InstructionDocument(creator_id=self.cid,name='name', instruction={"foo":"bar"}) with self.assertRaises(ShieldException): doc.validate()
def test_requires_instruction(self): """ Needs an instruction. """ doc = InstructionDocument(creator_id=self.cid, name='name') with self.assertRaises(ShieldException): doc.validate()
def test_requires_creator_id(self): """ Needs a creator. """ doc = InstructionDocument(instruction={"load": "google.com"}, name='name') with self.assertRaises(ShieldException): doc.validate()
def test_requires_name(self): """ Needs a name. """ doc = InstructionDocument(creator_id=self.cid, instruction={"load": "google.com"}) with self.assertRaises(ShieldException): doc.validate()