def delete_all_feeds(self, request, queryset): """ Delete all the feeds with all of its associated commands """ del queryset entries = FeedEntry.objects.all() for entry in entries: CommandController.delete_command_group_by_id(entry.command_group.id) entry.delete() self.message_user(request, "All Feed entries were deleted successfully.")
def test_delete_command_group(self): result = TestCommandHelper.create_default_command_result() self.assertEqual(1, CommandGroupEntry.objects.all().count()) self.assertEqual(1, CommandSetEntry.objects.all().count()) self.assertEqual(1, CommandEntry.objects.all().count()) self.assertEqual(1, CommandResultEntry.objects.all().count()) CommandController.delete_command_group_by_id( CommandGroupEntry.objects.all().first().id) self.assertEqual(0, CommandGroupEntry.objects.all().count()) self.assertEqual(0, CommandSetEntry.objects.all().count()) self.assertEqual(0, CommandEntry.objects.all().count()) self.assertEqual(0, CommandResultEntry.objects.all().count())