def test_delete_buildings_selected_buildings(self):
        # arrange: standard case, try to delete 10 buildings
        self._set_role_level(ROLE_MEMBER)
        self.assertEqual(BuildingSnapshot.objects.filter(
            canonicalbuilding__active=True).count(),
            self.NUMBER_ACTIVE
        )
        ids = BuildingSnapshot.objects.filter(
            canonicalbuilding__active=True
        ).values_list('pk', flat=True)[:10]

        # act
        resp = self.client.delete(
            reverse_lazy("seed:delete_buildings"),
            data=json.dumps(
                {
                    'organization_id': self.org.id,
                    'search_payload': {
                        'select_all_checkbox': False,
                        'selected_buildings': list(ids),
                    }

                }
            ),
            content_type='application/json',
        )

        # assert
        self.assertDictEqual(json.loads(resp.content), {'status': 'success'})
        # check that we have 10 less active buildings
        self.assertEqual(BuildingSnapshot.objects.filter(
            canonicalbuilding__active=True).count(),
            self.NUMBER_ACTIVE - 10
        )
        # check that the 10 buildings are inactive
        self.assertEqual(
            BuildingSnapshot.objects.filter(
                canonicalbuilding__active=False,
                pk__in=list(ids)
            ).count(),
            10
        )
tests delete_buildings for selected_buildings
dataset/ETHPy150Open buildingenergy/buildingenergy-platform/seed/tests/test_delete.py/DeleteViewTests.test_delete_buildings_selected_buildings