<commit_before>import datetime

from django.test import TestCase
from django.core.management import call_command

from AccountPickup.models import OAMStatusTracker
from ods_integration.models import Event


# Create your tests here.
class IntegrationTestCase(TestCase):
    def setUp(self):
        yesterday = datetime.date.today() - datetime.timedelta(days=1)
        last_week = datetime.date.today() - datetime.timedelta(days=7)

        OAMStatusTracker.objects.create(psu_uuid="agree-today", agree_aup=datetime.date.today())
        OAMStatusTracker.objects.create(psu_uuid="agree-yesterday", agree_aup=yesterday)
        OAMStatusTracker.objects.create(psu_uuid="agree-last-week", agree_aup=last_week)

        # Call the management command we're testing.
        call_command('nightly_export_aup')

    def test_today_not_included(self):<commit_msg>Added decorator to skip ods_integration tests if a valid sailpoint host isn't set.<commit_after>import datetime
import unittest

from django.conf import settings
from django.test import TestCase
from django.core.management import call_command

from AccountPickup.models import OAMStatusTracker
from ods_integration.models import Event


# Create your tests here.
@unittest.skipIf(settings.SAILPOINT_SERVER_URL == '', "No valid sailpoint host.")
class IntegrationTestCase(TestCase):
    def setUp(self):
        yesterday = datetime.date.today() - datetime.timedelta(days=1)
        last_week = datetime.date.today() - datetime.timedelta(days=7)

        OAMStatusTracker.objects.create(psu_uuid="agree-today", agree_aup=datetime.date.today())
        OAMStatusTracker.objects.create(psu_uuid="agree-yesterday", agree_aup=yesterday)
        OAMStatusTracker.objects.create(psu_uuid="agree-last-week", agree_aup=last_week)

        # Call the management command we're testing.
        call_command('nightly_export_aup')

    def test_today_not_included(self):
{'fraction_non_alphanumeric': 0.09299895506792058, 'fraction_numerical': 0.0020898641588296763, 'mean_word_length': 4.785498489425982, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3067017', 'n_tokens_mistral': 594, 'n_tokens_neox': 561, 'n_words': 116}