<s> import datetime <EOL> import pytz <EOL> from django . test import TestCase <EOL> from periods import models as period_models <EOL> from periods . management . commands import fix_timezone_for_period_data <EOL> from periods . tests . factories import FlowEventFactory <EOL> TIMEZONE = pytz . timezone ( "<STR_LIT>" ) <EOL> class TestCommand ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . command = fix_timezone_for_period_data . Command ( ) <EOL> flow_event = FlowEventFactory ( timestamp = TIMEZONE . localize ( <EOL> datetime . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0> , <NUM_LIT:0> ) ) ) <EOL> self . user = flow_event . user <EOL> FlowEventFactory ( user = self . user , <EOL> timestamp = TIMEZONE . localize ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:8> , <NUM_LIT> ) ) ) <EOL> def test_fix_timezone_for_period_data_no_periods ( self ) : <EOL> period_models . FlowEvent . objects . all ( ) . delete ( ) <EOL> self . command . handle ( ) <EOL> self . assertEqual ( <NUM_LIT:0> , period_models . FlowEvent . objects . count ( ) ) <EOL> def test_fix_timezone_for_period_data ( self ) : <EOL> self . command . handle ( ) <EOL> periods = period_models . FlowEvent . objects . all ( ) <EOL> self . assertEqual ( <NUM_LIT:2> , periods . count ( ) ) <EOL> self . assertEqual ( pytz . utc . localize ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT> , <NUM_LIT> ) ) , <EOL> periods [ <NUM_LIT:0> ] . timestamp ) <EOL> self . assertEqual ( pytz . utc . localize ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:8> , <NUM_LIT> , <NUM_LIT:4> ) ) , periods [ <NUM_LIT:1> ] . timestamp ) </s>
