
from openerp.tests.common import TransactionCase


class TestMedicalPatientSpecies(TransactionCase):

    def setUp(self):
        super(TestMedicalPatientSpecies, self).setUp()
        self.human = self.env.ref('medical_patient_species.human')
        self.dog = self.env.ref('medical_patient_species.dog')

    def test_create_is_person(self):
        ''' Tests on creation if Human, is_person is True '''
        self.assertTrue(
            self.human.is_person, 'Should be True if Human'
        )

    def test_create_not_is_person(self):
        ''' Tests on creation if not Human, is_person is False '''
        self.assertFalse(
            self.dog.is_person, 'Should be False if not Human'
        )


from openerp.tests.common import TransactionCase
from openerp.exceptions import Warning


class TestMedicalPatientSpecies(TransactionCase):

    def setUp(self):
        super(TestMedicalPatientSpecies, self).setUp()
        self.human = self.env.ref('medical_patient_species.human')
        self.dog = self.env.ref('medical_patient_species.dog')

    def test_unlink_human(self):
        ''' Test raises Warning if unlinking human '''
        with self.assertRaises(Warning):
            self.human.unlink()

Remove tests for is_person (default is False, human set to True in xml). Re-add test ensuring warning raised if trying to unlink Human.
[FIX] medical_patient_species: Remove tests for is_person (default is False, human set to True in xml).
Re-add test ensuring warning raised if trying to unlink Human.

  
  from openerp.tests.common import TransactionCase
+ from openerp.exceptions import Warning
  
  
  class TestMedicalPatientSpecies(TransactionCase):
  
      def setUp(self):
          super(TestMedicalPatientSpecies, self).setUp()
          self.human = self.env.ref('medical_patient_species.human')
          self.dog = self.env.ref('medical_patient_species.dog')
  
+     def test_unlink_human(self):
+         ''' Test raises Warning if unlinking human '''
+         with self.assertRaises(Warning):
+             self.human.unlink()
-     def test_create_is_person(self):
-         ''' Tests on creation if Human, is_person is True '''
-         self.assertTrue(
-             self.human.is_person, 'Should be True if Human'
-         )
  
-     def test_create_not_is_person(self):
-         ''' Tests on creation if not Human, is_person is False '''
-         self.assertFalse(
-             self.dog.is_person, 'Should be False if not Human'
-         )
- 
Remove tests for is_person (default is False, human set to True in xml). Re-add test ensuring warning raised if trying to unlink Human.
## Code Before:

from openerp.tests.common import TransactionCase


class TestMedicalPatientSpecies(TransactionCase):

    def setUp(self):
        super(TestMedicalPatientSpecies, self).setUp()
        self.human = self.env.ref('medical_patient_species.human')
        self.dog = self.env.ref('medical_patient_species.dog')

    def test_create_is_person(self):
        ''' Tests on creation if Human, is_person is True '''
        self.assertTrue(
            self.human.is_person, 'Should be True if Human'
        )

    def test_create_not_is_person(self):
        ''' Tests on creation if not Human, is_person is False '''
        self.assertFalse(
            self.dog.is_person, 'Should be False if not Human'
        )

## Instruction:
Remove tests for is_person (default is False, human set to True in xml). Re-add test ensuring warning raised if trying to unlink Human.
## Code After:

from openerp.tests.common import TransactionCase
from openerp.exceptions import Warning


class TestMedicalPatientSpecies(TransactionCase):

    def setUp(self):
        super(TestMedicalPatientSpecies, self).setUp()
        self.human = self.env.ref('medical_patient_species.human')
        self.dog = self.env.ref('medical_patient_species.dog')

    def test_unlink_human(self):
        ''' Test raises Warning if unlinking human '''
        with self.assertRaises(Warning):
            self.human.unlink()
