def test_validate_attributes(self): """ Get validate attributes """ enterprise = Enterprise() enterprise.name = "Test Enterprise" enterprise.allowed_forwarding_classes = 'A' is_valid = enterprise.validate() self.assertEqual(is_valid, True) self.assertEqual(len(enterprise.errors), 0)
def test_validate_with_attribute_choices(self): """ Get validate with too long attribute """ enterprise = Enterprise() enterprise.name = "Enterprise" enterprise.allowed_forwarding_classes = 'NOT_AN_OPTION_FROM_CHOICES' is_valid = enterprise.validate() self.assertEqual(is_valid, False) self.assertEqual(len(enterprise.errors), 1) self.assertIn("allowed_forwarding_classes", enterprise.errors)
def test_validate_with_wrong_subtype(self): """ Get validate with wrong subtype """ enterprise = Enterprise() enterprise.name = "Enterprise" enterprise.allowed_forwarding_classes = ['B', True] is_valid = enterprise.validate() self.assertEqual(is_valid, False) self.assertEqual(len(enterprise.errors), 1) self.assertIn("allowed_forwarding_classes", enterprise.errors)