コード例 #1
0
    def test_call(self):
        res_auth = MagicMock(spec=ResAuth, sessionid=None, csrftoken=None, url="www.abc.com")
        resp = ResAuth.__call__(res_auth, MagicMock(headers={}))
        self.assertDictEqual(resp.headers, {'referer': 'www.abc.com'})

        res_auth = MagicMock(spec=ResAuth, sessionid='my-id', csrftoken='my-token', url="abc.com")
        resp = ResAuth.__call__(res_auth, MagicMock(headers={}))
        self.assertDictEqual(resp.headers, {
            'X-CSRFToken': 'my-token',
            'referer': 'abc.com',
            'Cookie': 'csrftoken=my-token; sessionid=my-id'
        })
コード例 #2
0
    def test_call(self):
        res_auth = MagicMock(spec=ResAuth, sessionid=None, csrftoken=None, url="www.abc.com")
        resp = ResAuth.__call__(res_auth, MagicMock(headers={}))
        self.assertDictEqual(resp.headers, {'referer': 'www.abc.com'})

        res_auth = MagicMock(spec=ResAuth, sessionid='my-id', csrftoken='my-token', url="abc.com")
        resp = ResAuth.__call__(res_auth, MagicMock(headers={}))
        self.assertDictEqual(resp.headers, {
            'X-CSRFToken': 'my-token',
            'referer': 'abc.com',
            'Cookie': 'csrftoken=my-token; sessionid=my-id'
        })
コード例 #3
0
    def test_call(self):
        res_auth = MagicMock(
            spec=ResAuth, sessionid=None, csrftoken=None, url="www.abc.com"
        )
        resp = ResAuth.__call__(res_auth, MagicMock(headers={}))
        self.assertDictEqual(resp.headers, {"referer": "www.abc.com"})

        res_auth = MagicMock(
            spec=ResAuth, sessionid="my-id", csrftoken="my-token", url="abc.com"
        )
        resp = ResAuth.__call__(res_auth, MagicMock(headers={}))
        self.assertDictEqual(
            resp.headers,
            {"X-CSRFToken": "my-token", "referer": "abc.com"},
        )
コード例 #4
0
ファイル: test_resolwe.py プロジェクト: tjanez/resolwe-bio-py
 def test_call(self):
     res_auth = MagicMock(spec=ResAuth, sessionid="", csrftoken="")
     ResAuth.__call__(res_auth, MagicMock(headers={}))