<s> from __future__ import with_statement <EOL> import logging <EOL> l = logging . getLogger ( __name__ ) <EOL> from datetime import timedelta <EOL> from django . conf import settings <EOL> from django . core . management . base import CommandError <EOL> from django_lean . experiments . models import ( Experiment , DailyEngagementReport , <EOL> DailyConversionReport ) <EOL> from django_lean . experiments . management . commands import ( <EOL> update_experiment_reports <EOL> ) <EOL> from django_lean . experiments . tests . utils import patch , TestCase <EOL> class TestManagement ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . experiment = Experiment ( name = "<STR_LIT>" ) <EOL> self . experiment . save ( ) <EOL> self . experiment . state = Experiment . ENABLED_STATE <EOL> self . experiment . save ( ) <EOL> self . experiment . start_date = ( self . experiment . start_date - <EOL> timedelta ( days = <NUM_LIT:5> ) ) <EOL> self . experiment . save ( ) <EOL> def testManageCommand ( self ) : <EOL> with patch ( settings , '<STR_LIT>' , <EOL> '<STR_LIT>' ) : <EOL> self . assertRaises ( CommandError , <EOL> update_experiment_reports . Command ( ) . handle , <EOL> "<STR_LIT>" , "<STR_LIT:args>" ) <EOL> self . runner = update_experiment_reports . Command ( ) . run_from_argv <EOL> self . runner ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . assertEquals ( <NUM_LIT:5> , DailyEngagementReport . objects . filter ( <EOL> experiment = self . experiment ) . count ( ) ) <EOL> self . assertEquals ( <NUM_LIT:5> , DailyConversionReport . objects . filter ( <EOL> experiment = self . experiment ) . count ( ) ) </s>
