Example #1
0
    def setUp(self):
        '''
        Create organisations and surfaces
        '''

        self.secondary_category = ReportCategory.objects.all()[0]
        self.category = self.secondary_category.category_class

        self.region = OrganisationEntity(
            type=OrganisationEntity.REGION,
            name_nl="Region",
            name_fr="Region"
        )
        self.region.save()
        self.region_group = OrganisationEntity(
            type=OrganisationEntity.DEPARTMENT,
            name_nl="Werken",
            name_fr="Travaux",
            phone="090987",
            dependency=self.region,
            email="*****@*****.**"
        )
        self.region_group.save()

        self.region_group_mail_config       = GroupMailConfig()
        self.region_group_mail_config.group = self.region_group
        self.region_group_mail_config.save()

        self.commune = OrganisationEntity(
            name_nl="Commune",
            name_fr="Commune",
        )
        self.commune.save()
        self.commune_group = OrganisationEntity(
            type=OrganisationEntity.DEPARTMENT,
            name_nl="Werken",
            name_fr="Travaux",
            phone="090987",
            dependency=self.commune,
            email="*****@*****.**"
        )
        self.commune_group.save()
        self.commune_group.dispatch_categories.add(self.secondary_category)

        self.commune_group_mail_config       = GroupMailConfig()
        self.commune_group_mail_config.group = self.commune_group
        self.commune_group_mail_config.save()

        p1 = (148776, 171005)
        p2 = (150776, 171005)
        p3 = (150776, 169005)
        p4 = (148776, 169005)

        self.surface = OrganisationEntitySurface(
            geom=Polygon([p1, p2, p3, p4, p1]),
            owner=self.commune,
        )
        self.surface.save()

        p1 = (149756, 169985)
        p2 = (149796, 169985)
        p3 = (149796, 170025)
        p4 = (149756, 170025)

        self.street_surface = StreetSurface(
            geom=Polygon([p1, p2, p3, p4, p1]),
            administrator=StreetSurface.REGION,
        )
        self.street_surface.save()
Example #2
0
    def setUp(self):

        try:
            organisation = OrganisationEntity.objects.get(id=1)
        except ObjectDoesNotExist:
            organisation = OrganisationEntity(id=1, name="Test organisation")
            organisation.save()

        p1 = (148776, 171005)
        p2 = (150776, 171005)
        p3 = (150776, 169005)
        p4 = (148776, 169005)

        surface = OrganisationEntitySurface(
            geom=Polygon([p1, p2, p3, p4, p1]),
            owner=OrganisationEntity.objects.get(pk=14)
        )
        surface.save()

        #user_auth = User.objects.create_user(username='******', email='*****@*****.**', password='******')
        #user_auth.save()
        user = FMSUser(
            is_active=True,
            password="******",
            first_name="zaza",
            telephone="00000000",
            last_used_language="fr",
            organisation=organisation,
            username='******')
        user.save()

        #~ main_category = ReportMainCategoryClass(id=2,name_en='test main en',name_nl='test main nl',name_fr='test main fr')
        #~ main_category.save()
        #~
        #~ secondary_category = ReportSecondaryCategoryClass(id=2,name_en='test second en',name_nl='test second nl',name_fr='test second fr')
        #~ secondary_category.save()
        #~
        #~ category = ReportCategory(id=2,name_en='test parent en',name_nl='test parent nl',name_fr='test parent fr', public=True, category_class=main_category, secondary_category_class=secondary_category)
        #~ category.save()
        self.citizen = FMSUser(
            telephone="0123456789",
            last_used_language="fr",
            first_name="citizen",
            last_name="citizen",
            email="*****@*****.**"
        )
        self.citizen.save()

        self.manager = FMSUser(
            is_active=True,
            telephone="0123456789",
            last_used_language="fr",
            password='******',
            first_name="manager",
            last_name="manager",
            email="*****@*****.**",
            manager=True
        )
        self.manager.set_password('test')
        self.manager.organisation = OrganisationEntity.objects.get(pk=14)
        self.manager.save()

        self.group = OrganisationEntity(
            type="D",
            name_nl="Werken",
            name_fr="Travaux",
            phone="090987",
            dependency=OrganisationEntity.objects.get(pk=14),
            email="*****@*****.**"
            )
        self.group.save()

        self.group_mail_config       = GroupMailConfig()
        self.group_mail_config.group = self.group
        self.group_mail_config.save()

        self.usergroupmembership = UserOrganisationMembership(user_id=self.manager.id, organisation_id=self.group.id, contact_user=True)
        self.usergroupmembership.save()

        self.sample_post = {
            'report-x': '150056.538',
            'report-y': '170907.56',
            'report-address_fr': 'Avenue des Arts, 3',
            'report-address_nl': 'Kunstlaan, 3',
            'report-address_number': '3',
            'report-postalcode': '1210',
            'report-category': '1',
            'report-secondary_category': '1',
            'report-subscription': 'on',
            'report-terms_of_use_validated': True,

            'comment-text': 'test',

            'files-TOTAL_FORMS': 0,
            'files-INITIAL_FORMS': 0,
            'files-MAX_NUM_FORMS': 1000,

            'citizen-quality': '1',
            'citizen-email': self.citizen.email,
            'citizen-firstname': self.citizen.first_name,
            'citizen-lastname': self.citizen.last_name
        }

        """
Example #3
0
    def setUp(self):
        self.secondary_category = ReportCategory.objects.all()[0]
        self.category = self.secondary_category.category_class

        self.bxl = OrganisationEntity.objects.get(id=4)  # postal code = 1000 Bxl
        self.bxl.save()

        p1 = (148776, 171005)
        p2 = (150776, 171005)
        p3 = (150776, 169005)
        p4 = (148776, 169005)

        surface = OrganisationEntitySurface(
            geom=Polygon([p1, p2, p3, p4, p1]),
            owner=self.bxl,
        )
        surface.save()

        self.group = OrganisationEntity(
            type="D",
            name_nl="Werken",
            name_fr="Travaux",
            phone="090987",
            dependency=self.bxl,
            email="*****@*****.**"
        )
        self.group.save()

        self.group_mail_config       = GroupMailConfig()
        self.group_mail_config.group = self.group
        self.group_mail_config.save()

        self.agent = FMSUser(
            is_active=True,
            email="*****@*****.**",
            telephone="0123456789",
            last_used_language="fr",
            agent=True,
            organisation=self.bxl)
        self.agent.save()

        self.stib = OrganisationEntity.objects.get(id=21)
        self.stib.dependency = self.bxl
        self.stib.save()

        self.contractor = FMSUser(
            is_active=True,
            email="*****@*****.**",
            telephone="0123456789",
            last_used_language="fr",
            contractor=True,
            organisation=self.bxl)
        self.contractor.save()

        self.contractor_manager = FMSUser(
            is_active=True,
            email="*****@*****.**",
            telephone="90870870",
            last_used_language="fr",
            contractor=True,
            organisation=self.bxl,
            manager=True
        )
        self.contractor_manager.save()
        uom = UserOrganisationMembership(user=self.contractor_manager, organisation=self.group)
        uom.save()

        self.entity_manager = FMSUser(
            is_active=True,
            email="*****@*****.**",
            telephone="90870870",
            last_used_language="fr",
            leader=True,
            organisation=self.bxl,
            manager=True
        )
        self.entity_manager.save()
        self.usergroupmembership = UserOrganisationMembership(user_id = self.entity_manager.id, organisation_id = self.group.id)
        self.usergroupmembership.save()

        self.manager = FMSUser(
            is_active=True,
            email="*****@*****.**",
            telephone="0123456789",
            last_used_language="fr",
            manager=True,
            organisation=self.bxl
        )
        self.manager.save()
        self.usergroupmembership2 = UserOrganisationMembership(user_id = self.manager.id, organisation_id = self.group.id, contact_user = True)
        self.usergroupmembership2.save()

        self.citizen = FMSUser(
            email="*****@*****.**",
            telephone="0123456789",
            last_used_language="fr"
        )
        self.citizen.save()
Example #4
0
class GeographicDispatchingTest(FMSTestCase):

    def setUp(self):
        '''
        Create organisations and surfaces
        '''

        self.secondary_category = ReportCategory.objects.all()[0]
        self.category = self.secondary_category.category_class

        self.region = OrganisationEntity(
            type=OrganisationEntity.REGION,
            name_nl="Region",
            name_fr="Region"
        )
        self.region.save()
        self.region_group = OrganisationEntity(
            type=OrganisationEntity.DEPARTMENT,
            name_nl="Werken",
            name_fr="Travaux",
            phone="090987",
            dependency=self.region,
            email="*****@*****.**"
        )
        self.region_group.save()

        self.region_group_mail_config       = GroupMailConfig()
        self.region_group_mail_config.group = self.region_group
        self.region_group_mail_config.save()

        self.commune = OrganisationEntity(
            name_nl="Commune",
            name_fr="Commune",
        )
        self.commune.save()
        self.commune_group = OrganisationEntity(
            type=OrganisationEntity.DEPARTMENT,
            name_nl="Werken",
            name_fr="Travaux",
            phone="090987",
            dependency=self.commune,
            email="*****@*****.**"
        )
        self.commune_group.save()
        self.commune_group.dispatch_categories.add(self.secondary_category)

        self.commune_group_mail_config       = GroupMailConfig()
        self.commune_group_mail_config.group = self.commune_group
        self.commune_group_mail_config.save()

        p1 = (148776, 171005)
        p2 = (150776, 171005)
        p3 = (150776, 169005)
        p4 = (148776, 169005)

        self.surface = OrganisationEntitySurface(
            geom=Polygon([p1, p2, p3, p4, p1]),
            owner=self.commune,
        )
        self.surface.save()

        p1 = (149756, 169985)
        p2 = (149796, 169985)
        p3 = (149796, 170025)
        p4 = (149756, 170025)

        self.street_surface = StreetSurface(
            geom=Polygon([p1, p2, p3, p4, p1]),
            administrator=StreetSurface.REGION,
        )
        self.street_surface.save()

    def test_entity_surface_owner_is_responsible(self):
        report = Report(
            point=dict_to_point({"x": '149776', "y": '170005'}),
            postalcode=1000,
            address='my address',
            address_number='6h',
            secondary_category=self.secondary_category,
            category=self.category,
        )
        report.save()

        self.assertEqual(report.responsible_entity, self.commune)

    def test_regional_road_is_detected(self):
        report = Report(
            point=dict_to_point({"x": '149776', "y": '170005'}),
            postalcode=1000,
            address='my address',
            address_number='1',
            secondary_category=self.secondary_category,
            category=self.category,
        )
        report.save()

        self.assertTrue(report.address_regional)

        report = Report(
            point=dict_to_point({"x": '149776', "y": '170805'}),
            postalcode=1000,
            address='my address',
            address_number='1',
            secondary_category=self.secondary_category,
            category=self.category,
        )
        report.save()

        self.assertFalse(report.address_regional)


    def test_regional_road_is_detected_on_border(self):
        report = Report(
            # this point is outside the polygon of 1m
            point=dict_to_point({"x": '149776', "y": '170026'}),
            postalcode=1000,
            address='my address',
            address_number='1',
            secondary_category=self.secondary_category,
            category=self.category,
        )
        report.save()

        self.assertTrue(report.address_regional)


    def test_entity_surface_raise_exception_when_outside(self):
        report = Report(
            point=dict_to_point({"x": '0', "y": '0'}),
            postalcode=1000,
            address='my address',
            address_number='6h',
            secondary_category=self.secondary_category,
            category=self.category,
        )
        with self.assertRaises(Exception):
            report.save()
Example #5
0
    def setUp(self):
        self.citizen = FMSUser(
            telephone="0123456789",
            last_used_language="fr",
            first_name="Fake first name",
            last_name="Fake last name",
            email="*****@*****.**"
        )
        self.citizen.save()
        self.citizen2 = FMSUser(
            telephone="9876543210",
            last_used_language="nl",
            first_name="Fake first name2",
            last_name="Fake last name2",
            email="*****@*****.**"
        )
        self.citizen2.save()
        self.citizen3 = FMSUser(
            telephone="5649783210",
            last_used_language="nl",
            first_name="Fake first name3",
            last_name="Fake last name3",
            email="*****@*****.**"
        )
        self.citizen3.save()

        self.manager = FMSUser(
            is_active=True,
            telephone="0123456789",
            last_used_language="fr",
            password='******',
            first_name="manager",
            last_name="manager",
            email="*****@*****.**",
            manager=True
        )
        self.manager.set_password('test')
        self.manager.organisation = OrganisationEntity.objects.get(pk=14)
        self.manager.save()

        p1 = (148776, 171005)
        p2 = (150776, 171005)
        p3 = (150776, 169005)
        p4 = (148776, 169005)

        surface = OrganisationEntitySurface(
            geom=Polygon([p1, p2, p3, p4, p1]),
            owner=OrganisationEntity.objects.get(pk=14),
        )
        surface.save()

        self.group = OrganisationEntity(
            type="D",
            name_nl="Werken",
            name_fr="Travaux",
            phone="090987",
            dependency=OrganisationEntity.objects.get(pk=14),
            email="*****@*****.**"
            )
        self.group.save()
        self.group.dispatch_categories.add(ReportCategory.objects.get(pk=1))
        self.group.dispatch_categories.add(ReportCategory.objects.get(pk=2))

        self.group_mail_config       = GroupMailConfig()
        self.group_mail_config.group = self.group
        self.group_mail_config.save()

        self.manager.memberships.create(organisation=self.group, contact_user=True)

        self.manager2 = FMSUser(
            is_active=True,
            telephone="9876543210",
            last_used_language="nl",
            password='******',
            first_name="manager2",
            last_name="manager2",
            email="*****@*****.**",
            manager=True
        )
        self.manager2.set_password('test2')
        self.manager2.organisation = OrganisationEntity.objects.get(pk=14)
        self.manager2.save()

        self.manager2.memberships.create(organisation=self.group)

        self.manager3 = FMSUser(
            is_active=True,
            telephone="000000000",
            last_used_language="nl",
            password='******',
            first_name="manager3",
            last_name="manager3",
            email="*****@*****.**",
            manager=True
        )
        self.manager3.set_password('test3')
        self.manager3.organisation = OrganisationEntity.objects.get(pk=21)
        self.manager3.save()

        self.group2 = OrganisationEntity(
            type="D",
            name_nl="Werken",
            name_fr="Travaux",
            phone="090987",
            dependency=OrganisationEntity.objects.get(pk=21),
            email="*****@*****.**"
            )
        self.group2.save()
        self.group2.dispatch_categories.add(ReportCategory.objects.get(pk=1))

        self.group_mail_config2       = GroupMailConfig()
        self.group_mail_config2.group = self.group2
        self.group_mail_config2.save()

        self.manager3.memberships.create(organisation=self.group2)

        self.impetrant = OrganisationEntity(
            name_nl="MIVB",
            name_fr="STIB",
            type=OrganisationEntity.APPLICANT)
        self.impetrant.save()

        self.contractor = OrganisationEntity(
            name_nl="Fabricom GDF",
            name_fr="Fabricom GDF",
            type=OrganisationEntity.SUBCONTRACTOR)
        self.contractor.save()

        self.client = Client()

        self.sample_post_citizen = {
            'report-x': '150056.538',
            'report-y': '170907.56',
            'report-address_fr': 'Avenue des Arts, 3',
            'report-address_nl': 'Kunstlaan, 3',
            'report-address_number': '3',
            'report-postalcode': '1210',
            'report-category': '1',
            'report-secondary_category': '1',
            'report-subscription': 'on',
            'citizen-quality': '1',
            'comment-text': 'test',
            'files-TOTAL_FORMS': 0,
            'files-INITIAL_FORMS': 0,
            'files-MAX_NUM_FORMS': 0,
            'citizen-email': self.citizen.email,
            'citizen-firstname': self.citizen.first_name,
            'citizen-lastname': self.citizen.last_name,
            'report-terms_of_use_validated': True
        }

        self.sample_post_pro = {
            'report-x': '150056.538',
            'report-y': '170907.56',
            'report-address_fr': 'Avenue des Arts, 3',
            'report-address_nl': 'Kunstlaan, 3',
            'report-address_number': '3',
            'report-postalcode': '1210',
            'report-category': '1',
            'report-secondary_category': '1',
            'report-subscription': 'on',
            'comment-text': 'test',
            'files-TOTAL_FORMS': 0,
            'files-INITIAL_FORMS': 0,
            'files-MAX_NUM_FORMS': 0,
            'report-terms_of_use_validated': True
        }

        self.sample_post_comment = {
            'text' : 'Ceci est un commentaire'
        }
Example #6
0
    def setUp(self):
        self.client = Client()

        self.secondary_category = ReportCategory.objects.all()[0]
        self.category = self.secondary_category.category_class

        self.organisation = OrganisationEntity.objects.get(pk=4)
        self.department = OrganisationEntity(
            type="D",
            name_nl="Werken",
            name_fr="Travaux",
            phone="090987",
            dependency=self.organisation,
            email="*****@*****.**"
        )
        self.department.save()

        self.group_mail_config       = GroupMailConfig()
        self.group_mail_config.group = self.department
        self.group_mail_config.save()

        p1 = (148776, 171005)
        p2 = (150776, 171005)
        p3 = (150776, 169005)
        p4 = (148776, 169005)

        surface = OrganisationEntitySurface(
            geom=Polygon([p1, p2, p3, p4, p1]),
            owner=self.organisation,
        )
        surface.save()

        self.manager = FMSUser(
            is_active=True,
            telephone="0123456789",
            last_used_language="fr",
            password='******',
            first_name="manager",
            last_name="manager",
            email="*****@*****.**",
            manager=True
        )
        self.manager.set_password('test')
        self.manager.organisation = self.organisation
        self.manager.save()
        self.department.dispatch_categories.add(self.secondary_category)

        self.usergroupmembership = UserOrganisationMembership(user=self.manager, organisation=self.department, contact_user=True)
        self.usergroupmembership.save()

        self.applicant_group = OrganisationEntity(
            type="A",
            name_nl="Belgacom",
            name_fr="Belgacom",
            phone="090987",
            email="*****@*****.**"
        )
        self.applicant_group.save()

        self.applicant = FMSUser(
            is_active=True,
            telephone="0123456789",
            last_used_language="fr",
            password='******',
            first_name="manager",
            last_name="manager",
            email="*****@*****.**",
            manager=True
        )
        self.applicant.set_password('test')
        self.applicant.save()

        self.applicantmembership = UserOrganisationMembership(user=self.applicant, organisation=self.applicant_group, contact_user=True)
        self.applicantmembership.save()
Example #7
0
    def setUp(self):
        self.secondary_category = ReportCategory.objects.all()[0]
        self.category = self.secondary_category.category_class
        #Create a FMSUser
        self.etterbeek = OrganisationEntity.objects.get(id=5)  # postal code = 1040 Etterbeek
        self.etterbeek.save()
        self.bxl = OrganisationEntity.objects.get(id=4)  # postal code = 1000 Bxl
        self.bxl.save()

        p1 = (148776, 171005)
        p2 = (150776, 171005)
        p3 = (150776, 170005)
        p4 = (148776, 170005)

        surface = OrganisationEntitySurface(
            geom=Polygon([p1, p2, p3, p4, p1]),
            owner=self.bxl
        )
        surface.save()

        p1 = (148776, 170005)
        p2 = (150776, 170005)
        p3 = (150776, 169005)
        p4 = (148776, 169005)

        surface = OrganisationEntitySurface(
            geom=Polygon([p1, p2, p3, p4, p1]),
            owner=self.etterbeek
        )
        surface.save()

        self.manager_etterbeek = FMSUser(
            is_active=True,
            email="*****@*****.**",
            telephone="0123456789",
            last_used_language="fr",
            manager=True,
            organisation=self.etterbeek)
        self.manager_etterbeek.save()
        self.manager_bxl = FMSUser(
            is_active=True,
            email="*****@*****.**",
            telephone="0123456789",
            last_used_language="fr",
            manager=True,
            organisation=self.bxl)
        self.manager_bxl.save()

        self.group = OrganisationEntity(
            type="D",
            name_nl="Werken",
            name_fr="Travaux",
            phone="090987",
            dependency=self.bxl,
            email="*****@*****.**"
            )
        self.group.save()

        self.group_mail_config       = GroupMailConfig()
        self.group_mail_config.group = self.group
        self.group_mail_config.save()

        self.usergroupmembership = UserOrganisationMembership(user_id=self.manager_bxl.id, organisation_id=self.group.id, contact_user=True)
        self.usergroupmembership.save()

        self.group2 = OrganisationEntity(
            type="D",
            name_nl="Werken",
            name_fr="Travaux",
            phone="090987",
            dependency=self.etterbeek,
            email="*****@*****.**"
            )
        self.group2.save()

        self.group_mail_config2       = GroupMailConfig()
        self.group_mail_config2.group = self.group2
        self.group_mail_config2.save()

        self.usergroupmembership2 = UserOrganisationMembership(user_id=self.manager_etterbeek.id, organisation_id=self.group2.id, contact_user=True)
        self.usergroupmembership2.save()
        self.citizen = FMSUser(
            email="*****@*****.**",
            telephone="0123456789",
            last_used_language="fr")
        self.citizen.save()
Example #8
0
    def setUp(self):

        self.user = FMSUser(username='******', email='*****@*****.**', password='******')
        self.user.save()

        self.client = Client()

        self.citizen = FMSUser(
            telephone="0123456789",
            last_used_language="fr",
            first_name="citizen",
            last_name="citizen",
            email="*****@*****.**"
        )
        self.citizen.save()

        self.group = OrganisationEntity(
            type="D",
            name_nl="Werken",
            name_fr="Travaux",
            phone="090987",
            dependency=OrganisationEntity.objects.get(pk=14),
            email="*****@*****.**"
            )
        self.group.save()

        self.group_mail_config       = GroupMailConfig()
        self.group_mail_config.group = self.group
        self.group_mail_config.save()

        self.manager = FMSUser(
            is_active=True,
            telephone="0123456789",
            last_used_language="fr",
            password='******',
            first_name="manager",
            last_name="manager",
            email="*****@*****.**",
            manager=True
        )
        self.manager.set_password('test')
        self.manager.organisation = OrganisationEntity.objects.get(pk=14)
        self.manager.save()
        self.group.dispatch_categories.add(ReportCategory.objects.get(pk=1))

        p1 = (148776, 171005)
        p2 = (150776, 171005)
        p3 = (150776, 169005)
        p4 = (148776, 169005)

        surface = OrganisationEntitySurface(
            geom=Polygon([p1, p2, p3, p4, p1]),
            owner=OrganisationEntity.objects.get(pk=14),
        )
        surface.save()

        self.manager.memberships.create(organisation=self.group, contact_user=True)

        self.sample_post = {
            'report-x': '150056.538',
            'report-y': '170907.56',
            'report-address_fr': 'Avenue des Arts, 3',
            'report-address_nl': 'Kunstlaan, 3',
            'report-address_number': '3',
            'report-postalcode': '1210',
            'report-category': '1',
            'report-secondary_category': '1',
            'report-subscription': 'on',
            'comment-text': 'test',
            'files-TOTAL_FORMS': 0,
            'files-INITIAL_FORMS': 0,
            'files-MAX_NUM_FORMS': 0,
            'citizen-email': self.citizen.email,
            'citizen-firstname': self.citizen.first_name,
            'citizen-lastname': self.citizen.last_name,
            'citizen-quality': '1',
            'report-terms_of_use_validated': True
        }
        self.sample_post_2 = {
            'report-x': '150056',
            'report-y': '170907.56',
            'report-address_fr': 'Avenue des Arts, 3',
            'report-address_nl': 'Kunstlaan, 3',
            'report-address_number': '5',
            'report-postalcode': '1210',
            'report-category': '1',
            'report-secondary_category': '1',
            'report-subscription': 'on',
            'comment-text': 'test2',
            'files-TOTAL_FORMS': 0,
            'files-INITIAL_FORMS': 0,
            'files-MAX_NUM_FORMS': 0,
            'citizen-email': self.citizen.email,
            'citizen-firstname': self.citizen.first_name,
            'citizen-lastname': self.citizen.last_name,
            'citizen-quality': '1',
            'report-terms_of_use_validated': True
        }
    def setUp(self):
        self.citizen = FMSUser(
            telephone="0123456789",
            last_used_language="fr",
            first_name="citizen",
            last_name="citizen",
            email="*****@*****.**"
        )
        self.citizen.save()
        self.manager = FMSUser(
            is_active=True,
            telephone="0123456789",
            last_used_language="fr",
            password='******',
            first_name="manager",
            last_name="manager",
            email="*****@*****.**",
            manager=True
        )
        self.manager.set_password('test')
        self.manager.organisation = OrganisationEntity.objects.get(pk=14)
        self.manager.save()

        self.group = OrganisationEntity(
            type="D",
            name_nl="Werken",
            name_fr="Travaux",
            phone="090987",
            dependency=OrganisationEntity.objects.get(pk=14),
            email="*****@*****.**"
            )
        self.group.save()
        self.group.dispatch_categories.add(ReportCategory.objects.get(pk=1))

        self.group_mail_config = GroupMailConfig()
        self.group_mail_config.group = self.group
        self.group_mail_config.save()

        self.manager.memberships.create(organisation=self.group, contact_user=True)

        self.client = Client()

        self.manager2 = FMSUser(
            is_active=True,
            telephone="9876543210",
            last_used_language="nl",
            password='******',
            first_name="manager2",
            last_name="manager2",
            email="*****@*****.**",
            manager=True
        )
        self.manager2.set_password('test2')
        self.manager2.organisation = OrganisationEntity.objects.get(pk=14)
        self.manager2.save()

        self.group2 = OrganisationEntity(
            type="D",
            name_nl="Werken",
            name_fr="Travaux",
            phone="090987",
            dependency=OrganisationEntity.objects.get(pk=21),
            email="*****@*****.**"
        )
        self.group2.save()
        self.group2.dispatch_categories.add(ReportCategory.objects.get(pk=2))
        self.group2.dispatch_categories.add(ReportCategory.objects.get(pk=1))

        p1 = (148776, 171005)
        p2 = (150776, 171005)
        p3 = (150776, 169005)
        p4 = (148776, 169005)

        surface = OrganisationEntitySurface(
            geom=Polygon([p1, p2, p3, p4, p1]),
            owner=OrganisationEntity.objects.get(pk=14),
        )
        surface.save()

        self.manager2.memberships.create(organisation=self.group2)

        self.manager3 = FMSUser(
            is_active=True,
            telephone="000000000",
            last_used_language="nl",
            password='******',
            first_name="manager3",
            last_name="manager3",
            email="*****@*****.**",
            manager=True
        )
        self.manager3.set_password('test3')
        self.manager3.organisation = OrganisationEntity.objects.get(pk=21)
        self.manager3.save()

        self.manager3.memberships.create(organisation=self.group2)

        self.impetrant = OrganisationEntity(
            name_nl="MIVB",
            name_fr="STIB",
            email="*****@*****.**")

        self.impetrant.save()

        self.contractor = OrganisationEntity(
            name_nl="Fabricom GDF",
            name_fr="Fabricom GDF",
            email="*****@*****.**")
        self.contractor.save()

        self.sample_post = {
            'report-x': '150056.538',
            'report-y': '170907.56',
            'report-address_fr': 'Avenue des Arts, 3',
            'report-address_nl': 'Kunstlaan, 3',
            'report-address_number': '3',
            'report-postalcode': '1210',
            'report-category': '1',
            'report-secondary_category': '1',
            'report-subscription': 'on',
            'citizen-quality': '1',
            'comment-text': 'test',
            'files-TOTAL_FORMS': 0,
            'files-INITIAL_FORMS': 0,
            'files-MAX_NUM_FORMS': 0,
            'citizen-email': self.citizen.email,
            'citizen-firstname': self.citizen.first_name,
            'citizen-lastname': self.citizen.last_name,
            'report-terms_of_use_validated': True
        }

        ##### Following data was created specifically for the reopen_request tests #######

        self.citizen_reopen_request = FMSUser(
            telephone="987654321",
            last_used_language="fr",
            first_name="citizen_reopen_request",
            last_name="citizen_reopen_request",
            email="*****@*****.**"
        )
        self.citizen_reopen_request.save()

        self.sample_post_reopen_request_pro = {
            'reopen-text': 'this is the reopen request comment',
            'reopen-reason': 1
        }

        self.sample_post_reopen_request = {
            'reopen-text': 'this is the reopen request comment',
            'reopen-reason': 1,
            'citizen-quality': 2,
            'citizen-email': self.citizen_reopen_request.email,
            'citizen-telephone': self.citizen_reopen_request.telephone,
            'citizen-last_name': self.citizen_reopen_request.last_name,
        }