Ejemplo n.º 1
0
def test_access_key_uses_edw_hash(app, access_key):
    from encoded.edw_hash import EDWHash
    from encoded.contentbase import LOCATION_ROOT
    root = app.registry[LOCATION_ROOT]
    obj = root.by_item_type['access_key'][access_key['access_key_id']]
    pwhash = obj.properties['secret_access_key_hash']
    assert EDWHash.encrypt(access_key['secret_access_key']) == pwhash
Ejemplo n.º 2
0
def test_access_key_uses_edw_hash(app, access_key):
    from encoded.edw_hash import EDWHash
    from snovault import ROOT
    root = app.registry[ROOT]
    obj = root.by_item_type['access_key'][access_key['access_key_id']]
    pwhash = obj.properties['secret_access_key_hash']
    assert EDWHash.encrypt(access_key['secret_access_key']) == pwhash
Ejemplo n.º 3
0
def test_access_key_uses_edw_hash(app, access_key):
    from encoded.edw_hash import EDWHash
    from snovault import COLLECTIONS
    root = app.registry[COLLECTIONS]
    obj = root.by_item_type['access_key'][access_key['access_key_id']]
    pwhash = obj.properties['secret_access_key_hash']
    assert EDWHash.hash(access_key['secret_access_key']) == pwhash
Ejemplo n.º 4
0
def test_edw_key_create(testapp, anontestapp, access_key):
    from encoded.edw_hash import EDWHash
    email = access_key['user']['email']
    access_key_id = 'test_edw_user'
    password = '******'
    pwhash = EDWHash.encrypt(password)
    item = {'email': email, 'username': access_key_id, 'pwhash': pwhash}
    url = '/@@edw_key_create'
    testapp.post_json(url, item)

    headers = {'Authorization': basic_auth(access_key_id, password)}
    res = anontestapp.get('/@@testing-user', headers=headers)
    assert res.json['authenticated_userid'] == 'accesskey:' + access_key_id
    assert sorted(res.json['effective_principals']) == [
        'accesskey:' + access_key_id,
    ] + access_key['user']['effective_principals']
Ejemplo n.º 5
0
def test_edw_key_create(testapp, anontestapp, access_key):
    from encoded.edw_hash import EDWHash
    email = access_key['user']['email']
    access_key_id = 'test_edw_user'
    password = '******'
    pwhash = EDWHash.encrypt(password)
    item = {'email': email, 'username': access_key_id, 'pwhash': pwhash}
    url = '/@@edw_key_create'
    testapp.post_json(url, item)

    headers = {'Authorization': basic_auth(access_key_id, password)}
    res = anontestapp.get('/@@testing-user', headers=headers)
    assert res.json['authenticated_userid'] == 'accesskey.' + access_key_id
    assert sorted(res.json['effective_principals']) == [
        'accesskey.' + access_key_id,
    ] + access_key['user']['effective_principals']
Ejemplo n.º 6
0
def test_edw_hash(password, pwhash):
    from encoded.edw_hash import EDWHash
    assert EDWHash.hash(password) == pwhash
Ejemplo n.º 7
0
def test_edw_hash(password, pwhash):
    from encoded.edw_hash import EDWHash
    assert EDWHash.encrypt(password) == pwhash