Skip to content

Commit

Permalink
Exclude archiving from tests (for now)
Browse files Browse the repository at this point in the history
  • Loading branch information
gordonje committed Jun 20, 2017
1 parent 034446e commit 78484fd
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions calaccess_processed/tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
Unittests for management commands.
"""
import os
from django.utils import timezone
from django.test import TestCase, override_settings
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import CommandError
from django.utils import timezone
from django.test import TestCase, override_settings
from calaccess_raw import get_test_download_directory
from calaccess_processed.management.commands import (
CalAccessCommand,
Expand All @@ -26,7 +27,7 @@
)


@override_settings(CALACCESS_STORE_ARCHIVE=True)
@override_settings(CALACCESS_STORE_ARCHIVE=False)
class ProcessedDataCommandsTest(TestCase):
"""
Run and test management commands.
Expand Down Expand Up @@ -89,30 +90,31 @@ def test_commands(self):
msg="Multiple incumbents in {}!".format(contest),
)

processed_version = ProcessedDataVersion.objects.latest('process_start_datetime')
if getattr(settings, 'CALACCESS_STORE_ARCHIVE', False):
processed_version = ProcessedDataVersion.objects.latest('process_start_datetime')

# Confirm that the version finished
self.assertTrue(processed_version.update_completed)
# Confirm that zip file was archived
self.assertTrue(processed_version.zip_archive)
# Confirm that the size is correct
self.assertEqual(
processed_version.zip_size,
os.path.getsize(processed_version.zip_archive.path)
)

# For each processed data file...
for df in processed_version.files.all():
# Confirm the update completed
self.assertTrue(df.process_finish_datetime)
# Confirm that csv files where archived
self.assertTrue(df.file_archive)
# Confirm the correct file size
# Confirm that the version finished
self.assertTrue(processed_version.update_completed)
# Confirm that zip file was archived
self.assertTrue(processed_version.zip_archive)
# Confirm that the size is correct
self.assertEqual(
df.file_size,
os.path.getsize(df.file_archive.path)
processed_version.zip_size,
os.path.getsize(processed_version.zip_archive.path)
)

# For each processed data file...
for df in processed_version.files.all():
# Confirm the update completed
self.assertTrue(df.process_finish_datetime)
# Confirm that csv files where archived
self.assertTrue(df.file_archive)
# Confirm the correct file size
self.assertEqual(
df.file_size,
os.path.getsize(df.file_archive.path)
)

def test_base_command(self):
"""
Test options on base commands.
Expand Down

0 comments on commit 78484fd

Please sign in to comment.