diff --git a/concordia/tests/data/site_reports.csv b/concordia/tests/data/site_reports.csv new file mode 100644 index 000000000..6ae8130f0 --- /dev/null +++ b/concordia/tests/data/site_reports.csv @@ -0,0 +1,3 @@ +created_on,time,campaign +05/27/2024,10:13 PM UTC,1 +05/26/2024,10:12 PM UTC, diff --git a/concordia/tests/test_management_commands.py b/concordia/tests/test_management_commands.py new file mode 100644 index 000000000..672c4dce1 --- /dev/null +++ b/concordia/tests/test_management_commands.py @@ -0,0 +1,39 @@ +from io import StringIO + +from django.core.management import call_command +from django.test import TestCase + +from concordia.tests.utils import create_asset, create_campaign + + +class EnsureInitialSiteConfigurationTests(TestCase): + def test_command_output(self, *args, **kwargs): + out = StringIO() + call_command( + "ensure_initial_site_configuration", admin_email="admin@loc.gov", stdout=out + ) + call_command( + "ensure_initial_site_configuration", site_domain="crowd.loc.gov", stdout=out + ) + + +class ImportSiteReportsTests(TestCase): + def test_command_output(self, *args, **kwargs): + out = StringIO() + create_campaign(id=1) + call_command( + "import_site_reports", + csv_file="concordia/tests/data/site_reports.csv", + stdout=out, + ) + + +class PrintFrontendTestUrlsTests(TestCase): + def test_command_output(self, *args, **kwargs): + out = StringIO() + call_command("print_frontend_test_urls", stdout=out) + self.assertIn("", out.getvalue()) + + create_asset() + call_command("print_frontend_test_urls", stdout=out) + self.assertIn("", out.getvalue())