def test_anonymous(self):

        request = self.get_request()

        # a fake manual way of testing the middleware out
        # this is just assuming setting our document.cookie worked
        # right from javascript
        mw = TimezonesMiddleware()
        
        request.COOKIES = {
            'timezone' : 'Australia/Victoria'
        }

        utcnow = datetime.utcnow().replace(tzinfo = pytz.utc)

        mw.process_request(request)
        now1 = timezone.localtime(timezone.now())
        
        request.COOKIES = {
            'timezone' : 'America/New_York'
        }      
     
        mw.process_request(request)
        now2 = timezone.localtime(timezone.now())

        # assertion time
        self.assertNotEqual(utcnow, now1)
        self.assertNotEqual(utcnow, now2)
        self.assertNotEqual(now1, now2)
Testing Anonymous Cookie Based Users
dataset/ETHPy150Open jamesmfriedman/django-easytz/easytz/tests.py/TimezoneTestCase.test_anonymous