예제 #1
0
파일: test_simple.py 프로젝트: em-2/em2
async def test_invalid_public_key():
    auth = SimpleAuthenticator()
    auth.public_key_value = 'whatever'
    auth._now_unix = lambda: TS

    with pytest.raises(FailedInboundAuthentication) as excinfo:
        await auth.authenticate_platform(PLATFORM, TIMESTAMP, VALID_SIGNATURE)
    assert excinfo.value.args[0] == 'RSA key format is not supported'
예제 #2
0
파일: test_simple.py 프로젝트: em-2/em2
async def test_key_verification_old_ts():
    auth = SimpleAuthenticator()
    auth._now_unix = lambda: TS
    with pytest.raises(FailedInboundAuthentication) as excinfo:
        await auth.authenticate_platform('foobar.com', 2461449100, VALID_SIGNATURE)
    assert excinfo.value.args[0] == '2461449100 was not between 2461449590 and 2461449601'
예제 #3
0
파일: test_simple.py 프로젝트: em-2/em2
async def test_key_verification():
    auth = SimpleAuthenticator()
    auth._now_unix = lambda: TS

    platform_key = await auth.authenticate_platform(PLATFORM, TIMESTAMP, VALID_SIGNATURE)
    await auth.valid_platform_token(platform_key)
예제 #4
0
파일: test_simple.py 프로젝트: em-2/em2
async def test_key_verification_bad_signature():
    auth = SimpleAuthenticator()
    auth._now_unix = lambda: TS
    with pytest.raises(FailedInboundAuthentication) as excinfo:
        await auth.authenticate_platform(PLATFORM, TIMESTAMP, VALID_SIGNATURE.replace('2', '3'))
    assert excinfo.value.args[0] == 'invalid signature'
예제 #5
0
파일: conftest.py 프로젝트: em-2/em2
def _create_app(loop):
    ds = SimpleDataStore()
    ctrl = Controller(ds)
    auth = SimpleAuthenticator()
    auth._now_unix = lambda: 2461449600
    return create_app(ctrl, auth, loop=loop)