fix ip header

This commit is contained in:
virusdefender
2018-01-06 23:53:41 +08:00
parent d8221ca8f5
commit 0e83a920b2
5 changed files with 11 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
import hashlib
from unittest import mock
from django.conf import settings
from django.utils import timezone
from options.options import SysOptions
@@ -87,7 +88,7 @@ class JudgeServerHeartbeatTest(APITestCase):
self.token = "test"
self.hashed_token = hashlib.sha256(self.token.encode("utf-8")).hexdigest()
SysOptions.judge_server_token = self.token
self.headers = {"HTTP_X_JUDGE_SERVER_TOKEN": self.hashed_token, "HTTP_X_REAL_IP": "1.2.3.4"}
self.headers = {"HTTP_X_JUDGE_SERVER_TOKEN": self.hashed_token, settings.IP_HEADER: "1.2.3.4"}
def test_new_heartbeat(self):
resp = self.client.post(self.url, data=self.data, **self.headers)