Exemple #1
0
def test_websocket_good_origin(config):
    config.registry.settings.update({'origins': 'http://good'})
    config.include('h.streamer')
    req = DummyRequest(headers={'Origin': 'http://good'})
    req.get_response = MagicMock()
    res = websocket(req)
    assert res.code != 403
Exemple #2
0
def test_websocket_same_origin(config):
    config.include('h.streamer')
    # example.com is the dummy request default host URL
    req = DummyRequest(headers={'Origin': 'http://example.com'})
    req.get_response = MagicMock()
    res = websocket(req)
    assert res.code != 403
Exemple #3
0
def test_websocket_same_origin(config):
    config.include('h.streamer')
    # example.com is the dummy request default host URL
    req = DummyRequest(headers={'Origin': 'http://example.com'})
    req.get_response = MagicMock()
    res = websocket(req)
    assert res.code != 403
Exemple #4
0
def test_websocket_good_origin(config):
    config.registry.settings.update({'origins': 'http://good'})
    config.include('h.streamer')
    req = DummyRequest(headers={'Origin': 'http://good'})
    req.get_response = MagicMock()
    res = websocket(req)
    assert res.code != 403
Exemple #5
0
def test_websocket_good_origin(config):
    config.registry.settings.update({"origins": "http://good"})
    config.include("h.streamer")
    req = DummyRequest(headers={"Origin": "http://good"})
    req.get_response = MagicMock()
    res = websocket(req)
    assert res.code != 403
Exemple #6
0
def test_websocket_bad_origin():
    settings = {'origins': 'http://good'}
    with testConfig(settings=settings) as config:
        config.include('h.streamer')
        req = DummyRequest(headers={'Origin': 'http://bad'})
        res = websocket(req)
        assert res.code == 403
Exemple #7
0
def test_websocket_good_origin():
    settings = {'origins': 'http://good'}
    with testConfig(settings=settings) as config:
        config.include('h.streamer')
        req = DummyRequest(headers={'Origin': 'http://good'})
        req.get_response = MagicMock()
        res = websocket(req)
        assert res.code != 403