def test_approval_validation(self):
     service = ServiceFactory(location=None)
     # No location - should not allow approval
     try:
         service.validate_for_approval()
     except ValidationError as e:
         self.assertIn('location', e.error_dict)
     else:
         self.fail("Should have gotten ValidationError")
     # Add location, should be okay
     service.location = 'POINT(5 23)'
     service.validate_for_approval()
     # No name, should fail
     service.name_en = service.name_ar = service.name_fr = ''
     try:
         service.validate_for_approval()
     except ValidationError as e:
         self.assertIn('name', e.error_dict)
     else:
         self.fail("Should have gotten ValidationError")
 def test_approval_validation(self):
     service = ServiceFactory(location=None)
     # No location - should not allow approval
     try:
         service.validate_for_approval()
     except ValidationError as e:
         self.assertIn('location', e.error_dict)
     else:
         self.fail("Should have gotten ValidationError")
     # Add location, should be okay
     service.location = 'POINT(5 23)'
     service.validate_for_approval()
     # No name, should fail
     service.name_en = service.name_ar = service.name_fr = ''
     try:
         service.validate_for_approval()
     except ValidationError as e:
         self.assertIn('name', e.error_dict)
     else:
         self.fail("Should have gotten ValidationError")
 def test_approval_validation(self):
     service = ServiceFactory(location=None)
     # No location - should not allow approval
     try:
         service.validate_for_approval()
     except ValidationError as e:
         self.assertIn('location', e.error_dict)
     else:
         self.fail("Should have gotten ValidationError")
     # Add location, should be okay
     service.location = 'POINT(5 23)'
     service.validate_for_approval()
     # No name, should fail
     name_fields = generate_translated_fields('name', False)
     for field in name_fields:
         setattr(service, field, '')
     try:
         service.validate_for_approval()
     except ValidationError as e:
         self.assertIn('name', e.error_dict)
     else:
         self.fail("Should have gotten ValidationError")