Skip to content

Commit

Permalink
address lint warning
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvin-muchiri committed Jan 14, 2025
1 parent b7d546c commit 2851718
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
16 changes: 10 additions & 6 deletions onadata/apps/logger/management/commands/export_data.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# -*- coding: utf-8 -*-
"""
Management command to export data from a form in CSV format.
"""

from django.core.management.base import BaseCommand

from codetiming import Timer

from onadata.apps.logger.models.xform import XForm
from onadata.apps.viewer.models.export import Export
from onadata.libs.utils.export_tools import generate_export

from codetiming import Timer


class Command(BaseCommand):
help = "Exports data from a form in CSV format"
Expand Down Expand Up @@ -35,8 +39,8 @@ def handle(self, *args: str, **options: str):
plural_or_singular = (
"submission" if xform.num_of_submissions == 1 else "submissions"
)
self.stdout.write(
self.style.SUCCESS(
f'{export.pk}: Exporting {xform.num_of_submissions} {plural_or_singular} of the form "{xform.title}"'
)
msg = (
f"{export.pk}: Exporting {xform.num_of_submissions}"
f'{plural_or_singular} of the form "{xform.title}"'
)
self.stdout.write(self.style.SUCCESS(msg))
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
# -*- coding: utf-8 -*-
"""
Tests for the onadata.apps.logger.management.commands.export_data module.
"""

from io import StringIO

from django.core.management import call_command
from django.core.management.base import CommandError

from onadata.apps.main.tests.test_base import TestBase
from onadata.apps.viewer.models.export import Export


class ExportDataTest(TestBase):
"""Tests for the export_data management command."""

def test_command_output(self):
"""Test the output of the export_data management command."""
output = StringIO()
error_output = StringIO()
with self.assertRaisesMessage(
Expand Down

0 comments on commit 2851718

Please sign in to comment.