예제 #1
0
    def test_IUCNStatus_delete(self):
        """
        Tests iucn status model delete
        """
        model = IUCNStatusF.create()
        model.delete()

        # check if deleted
        self.assertTrue(model.pk is None)
예제 #2
0
    def test_IUCNStatus_read(self):
        """
        Tests iucn status model read
        """
        model = IUCNStatusF.create(
            category=u'custom iucn status',
            sensitive=False,
        )

        self.assertTrue(model.category == 'custom iucn status')
        self.assertFalse(model.sensitive)
예제 #3
0
    def test_IUCNStatus_create(self):
        """
        Tests iucn status creation
        """
        model = IUCNStatusF.create()

        # check if pk exists
        self.assertTrue(model.pk is not None)

        # check if name exists
        self.assertTrue(model.category is not None)
예제 #4
0
    def test_IUCNStatus_update(self):
        """
        Tests iucn status model update
        """
        model = IUCNStatusF.create()
        new_data = {
            'category': u'new name',
            'sensitive': False,
        }
        model.__dict__.update(new_data)
        model.save()

        # check if updated
        for key, val in new_data.items():
            self.assertEqual(model.__dict__.get(key), val)
예제 #5
0
    def test_Taxon_read(self):
        """
        Tests taxon model read
        """
        iucn_status = IUCNStatusF.create(
            category=u'custom iucn status',
            sensitive=True,
        )
        model = TaxonomyF.create(iucn_status=iucn_status,
                                 scientific_name=u'custom scientific name',
                                 canonical_name=u'custom common name',
                                 author=u'custom author')

        self.assertTrue(model.iucn_status.category == 'custom iucn status')
        self.assertTrue(model.scientific_name == 'custom scientific name')
        self.assertTrue(model.canonical_name == 'custom common name')
        self.assertTrue(model.author == 'custom author')
예제 #6
0
    def test_Taxon_update(self):
        """
        Tests taxon model update
        """
        model = TaxonF.create()
        iucn_status = IUCNStatusF.create(
            category=u'custom iucn status',
            sensitive=True,
        )
        new_data = {
            'iucn_status': iucn_status,
            'scientific_name': u'new scientific name',
            'common_name': u'new common name',
            'author': u'custom author',
        }
        model.__dict__.update(new_data)
        model.save()

        # check if updated
        for key, val in new_data.items():
            self.assertEqual(model.__dict__.get(key), val)