def test_autotype(self): h = Hash() h.simple_hash_value = "0123456789abcdef0123456789abcdef" self.assertEqual(h.type_, Hash.TYPE_MD5) h.type_ = Hash.TYPE_OTHER self.assertEqual(h.type_, Hash.TYPE_OTHER) h.simple_hash_value = "0123456789abcdef0123456789abcdef" self.assertEqual(h.type_, Hash.TYPE_OTHER) h2 = Hash() h2.type_ = Hash.TYPE_OTHER h2.simple_hash_value = "0123456789abcdef0123456789abcdef" self.assertEqual(h2.type_, Hash.TYPE_OTHER)
def test_add_vocabstring(self): from cybox.common import Hash from cybox.common.vocabs import ActionName action = ActionName(ActionName.TERM_ADD_USER) h = Hash() h.type_ = action self.assertEqual(action, h.type_)