def setUp(self): t, u, c, _ = Fixtures.create_users() self.org = Fixtures.create_organisation(t, u, c) self.org2 = Organisation.objects.create( name="Test0rg", description="A test description", created_by=self.org.created_by, updated_by=self.org.updated_by) self.org3 = Organisation.objects.create( name="Another org", description="A Test0rg description", created_by=self.org.created_by, updated_by=self.org.updated_by) location1 = Fixtures.create_location(self.org) location2 = Fixtures.create_another_location(self.org) self.s1 = Service.objects.create(name="Food For All", description="A handy food activity", organisation=self.org, created_by=t, updated_by=u) self.s2 = Service.objects.create( name="Physical Fun", description="Physical activity classes", organisation=self.org, created_by=t, updated_by=u) self.s3 = Service.objects.create( name="Step Fit 1", description="Physical activity classes", organisation=self.org, created_by=t, updated_by=u) self.s4 = Service.objects.create( name="Step Fit 2", description="Phyzical activiti classes", organisation=self.org, created_by=t, updated_by=u) self.s1.locations.add(location1) self.s1.save() self.s2.locations.add(location1) self.s2.save() self.s3.locations.add(location1) self.s3.save() self.s4.locations.add(location2) self.s4.save() pks = [self.s1.pk, self.s2.pk, self.s3.pk, self.s4.pk] self.queryset = get_services(Fixtures.es_connection(), pks)
def setUp(self): t, u, c, _ = Fixtures.create_users() o = Fixtures.create_organisation(t, u, c) s = Service.objects.create(name="My First Service", description="A handy service", organisation=o, created_by=t, updated_by=u) s.service_areas.add( ServiceArea.objects.get(name="Glasgow City", type=2)) self.s2 = Service.objects.create(name="My Testing Service", description="A testing service", organisation=o, created_by=t, updated_by=u) l = Fixtures.create_location(o) self.s2.locations.add(l) self.s2.service_areas.add( ServiceArea.objects.get(name="Glasgow City", type=2)) self.s2.save() brechin_postcode = Postcode.objects.create( postcode="DD9 6AD", postcode_district="DD9", postcode_sector="DD3 8", latitude="56.73313937", longitude="-2.65779541", council_area_2011_code="S12000041", health_board_area_2014_code="S08000027", integration_authority_2016_code="S37000003") erskine_postcode = Postcode.objects.create( postcode="PA8 7WZ", postcode_district="PA8", postcode_sector="PA8 7", latitude="55.9054667", longitude="-4.45330031", council_area_2011_code="S12000038", health_board_area_2014_code="S08000021", integration_authority_2016_code="S37000024") dundee_postcode = Postcode.objects.create( postcode="DD3 8EA", postcode_district="DD3", postcode_sector="DD3 8", latitude="56.47774662", longitude="-2.98519045", council_area_2011_code="S12000042", health_board_area_2014_code="S08000027", integration_authority_2016_code="S37000007") self.location_brechin = Location.objects.create( name="Brechin location", street_address="Brechin Street", locality="another locality", postal_code="DD9 6AD", latitude=56.73313937, longitude=-2.65779541, organisation=o, created_by=o.created_by, updated_by=o.updated_by) self.location_erskine = Location.objects.create( name="Erskine location", street_address="Erskine Street", locality="another locality", postal_code="PA8 7WZ", latitude=55.9054667, longitude=-4.45330031, organisation=o, created_by=o.created_by, updated_by=o.updated_by) self.location_dundee = Location.objects.create( name="Dundee location", street_address="Dundee Street", locality="another locality", postal_code="DD3 8EA", latitude=56.47774662, longitude=-2.98519045, organisation=o, created_by=o.created_by, updated_by=o.updated_by) self.location_glasgow_not_in_district = Location.objects.create( name="Glasgow not in district", street_address="Glasgow not in District Street", locality="another locality", postal_code="G1 1AB", latitude=55.860737, longitude=-4.244422, organisation=o, created_by=o.created_by, updated_by=o.updated_by) self.location_glasgow_in_district = Location.objects.create( name="Glasgow location", street_address="Glasgow Street", locality="another locality", postal_code="G2 1AA", latitude=55.86101, longitude=-4.24947, organisation=o, created_by=o.created_by, updated_by=o.updated_by) self.another_glasgow_in_district = Location.objects.create( name="Another Glasgow location", street_address="Another Glasgow Street", locality="another locality", postal_code="G2 1RY", latitude=55.861672, longitude=-4.252545, organisation=o, created_by=o.created_by, updated_by=o.updated_by) self.multi_location_service = Service.objects.create( name="Multi Location Service", description="A handy service", organisation=o, created_by=t, updated_by=u) self.multi_location_service.locations.add(self.location_brechin) self.multi_location_service.locations.add(self.location_erskine) self.multi_location_service.locations.add(self.location_dundee) self.multi_location_service.locations.add( self.location_glasgow_not_in_district) self.multi_location_service.save()