Esempio n. 1
0
    def test_boundary_type_read(self):
        """
        Tests read
        """
        boundary_type = BoundaryTypeF.create(name='country')

        self.assertTrue(boundary_type.name == 'country')
Esempio n. 2
0
    def test_boundary_type_create(self):
        """
        Tests creation
        """
        boundary_type = BoundaryTypeF.create()

        # check if pk exists
        self.assertTrue(boundary_type.pk is not None)
Esempio n. 3
0
    def test_boundary_read(self):
        """
        Tests read
        """
        boundary_type = BoundaryTypeF.create(name='country')
        boundary = BoundaryF.create(name='South Africa', type=boundary_type)

        self.assertTrue(boundary.name == 'South Africa')
        self.assertTrue(boundary.type.name == 'country')
Esempio n. 4
0
    def test_boundary_type_delete(self):
        """
        Tests boundary type model delete
        """
        boundary_type = BoundaryTypeF.create()
        boundary_type.delete()

        # check if deleted
        self.assertTrue(boundary_type.pk is None)
Esempio n. 5
0
    def test_boundary_type_update(self):
        """
        Tests boundary type update
        """
        boundary_type = BoundaryTypeF.create()
        boundary_type_data = {'name': 'province'}
        boundary_type.__dict__.update(boundary_type_data)
        boundary_type.save()

        # check if updated
        for key, val in boundary_type_data.items():
            self.assertEqual(getattr(boundary_type, key), val)
Esempio n. 6
0
    def test_boundary_update(self):
        """
        Tests boundary update
        """
        boundary_type = BoundaryTypeF.create(name='country')
        boundary = BoundaryF.create()
        boundary_data = {'name': 'South Africa', 'type': boundary_type}
        boundary.__dict__.update(boundary_data)
        boundary.type = boundary_type
        boundary.save()

        # check if updated
        for key, val in boundary_data.items():
            self.assertEqual(getattr(boundary, key), val)
Esempio n. 7
0
    def test_cluster_read(self):
        """
        Tests read
        """
        boundary_type = BoundaryTypeF.create(name='country')
        boundary = BoundaryF.create(name='South Africa', type=boundary_type)
        cluster = ClusterF.create(boundary=boundary,
                                  site_count=10,
                                  details='{}',
                                  module='fish')

        self.assertTrue(cluster.boundary.name == 'South Africa')
        self.assertTrue(cluster.boundary.type.name == 'country')
        self.assertTrue(cluster.site_count == 10)
        self.assertTrue(cluster.module == 'fish')
        self.assertTrue(cluster.details == '{}')
Esempio n. 8
0
    def test_cluster_update(self):
        """
        Tests cluster update
        """
        boundary_type = BoundaryTypeF.create(name='country')
        boundary = BoundaryF.create(
            name='South Africa',
            type=boundary_type,
        )
        cluster_data = {
            'site_count': 1,
            'details': '{}',
            'module': 'rock',
            'boundary': boundary
        }
        cluster = ClusterF.create()
        cluster.__dict__.update(cluster_data)
        cluster.boundary = boundary
        cluster.save()

        # check if updated
        for key, val in cluster_data.items():
            self.assertEqual(getattr(cluster, key), val)