示例#1
0
    def test_redis_not_used_by_arg(self, settings):
        settings.REDIS_LOG_POSTCODE = True
        postcode = {"postcode": "TE1 1ST"}

        log_postcode(log_dict=postcode, blocking=True)

        LoggedPostcode.objects.create.assert_called_once_with(**postcode)
        redis.Redis.assert_not_called()
示例#2
0
    def test_redis_used(self, settings):
        settings.REDIS_LOG_POSTCODE = True
        postcode = {"postcode": "TE1 1ST"}

        log_postcode(log_dict=postcode)

        LoggedPostcode.objects.create.assert_not_called()
        redis.Redis.assert_called_once()
        redis.Redis.return_value.zadd.assert_called_once()
示例#3
0
 def log_postcode(self, postcode):
     kwargs = {"postcode": postcode}
     kwargs.update(self.request.session["utm_data"])
     log_postcode(kwargs)
示例#4
0
 def log_postcode(self, postcode):
     kwargs = {
         'postcode': postcode,
     }
     kwargs.update(self.request.session['utm_data'])
     log_postcode(kwargs)
示例#5
0
 def log_postcode(self, postcode):
     kwargs = {"postcode": postcode}
     kwargs.update(self.request.session["utm_data"])
     log_postcode(kwargs)
示例#6
0
 def log_postcode(self, postcode):
     kwargs = {
         'postcode': postcode,
     }
     kwargs.update(self.request.session['utm_data'])
     log_postcode(kwargs)