def test_validate_required(self):
     organization = BusinessOrganization(self.organization_data)
     organization.__parent__ = SchematicsDocument()
     with self.assertRaises(ModelValidationError) as e:
         organization.validate()
     self.assertEqual(e.exception.message,
                      {"scale": [u"This field is required."]})
 def test_validate_valid(self):
     organization = BusinessOrganization(
         dict(scale="micro", **self.organization_data))
     organization.__parent__ = SchematicsDocument()
     organization.validate()
     data = organization.serialize("embedded")
     self.assertIn("scale", data)
     self.assertIn(data["scale"], "micro")
 def test_validate_not_valid(self):
     organization = BusinessOrganization(
         dict(scale="giant", **self.organization_data))
     organization.__parent__ = SchematicsDocument()
     with self.assertRaises(ModelValidationError) as e:
         organization.validate()
     self.assertEqual(
         e.exception.message, {
             "scale": [
                 u"Value must be one of ['micro', 'sme', 'mid', 'large', 'not specified']."
             ]
         })
 def test_validate_not_required(self):
     organization = BusinessOrganization(self.organization_data)
     organization.__parent__ = SchematicsDocument()
     organization.validate()
     data = organization.serialize("embedded")
     self.assertNotIn("scale", data)