Beispiel #1
0
def test_authenticate_invalid_signatures_format(helpers, node, addresses):
    [SF_address, user1_address] = addresses
    token_authnr = TokenAuthNr(ACCEPTABLE_WRITE_TYPES, ACCEPTABLE_QUERY_TYPES,
                               ACCEPTABLE_ACTION_TYPES,
                               node[0].db_manager.idr_cache)
    outputs = [{
        "address": SF_address,
        "amount": 30
    }, {
        "address": user1_address,
        "amount": 30
    }]
    request = helpers.request.mint(outputs)
    req_data = request.as_dict
    req_data[f.SIGS.nm] = {
        'M9BJDuS24bqbJNvBRsoGg3': 'INVALID_SIG1',
        'B8fV7naUqLATYocqu7yZ8W': 'INVALID_SIG2',
        'E7QRhdcnhAwA6E46k9EtZo': 'INVALID_SIG3',
        'CA4bVFDU4GLbX8xZju811o': 'INVALID_SIG3'
    }
    with pytest.raises(InvalidSignatureFormat):
        token_authnr.authenticate(req_data)
Beispiel #2
0
def test_authenticate_success_3_sigs(helpers, node, addresses):
    [SF_address, user1_address] = addresses
    token_authnr = TokenAuthNr(node[0].states[DOMAIN_LEDGER_ID])
    outputs = [{
        "address": SF_address,
        "amount": 30
    }, {
        "address": user1_address,
        "amount": 30
    }]
    request = helpers.request.mint(outputs)
    req_data = request.as_dict
    correct_sigs = token_authnr.authenticate(req_data)
    assert len(correct_sigs) == 3
Beispiel #3
0
def test_authenticate_success_3_sigs(helpers, node, addresses):
    [SF_address, user1_address] = addresses
    token_authnr = TokenAuthNr(ACCEPTABLE_WRITE_TYPES, ACCEPTABLE_QUERY_TYPES,
                               ACCEPTABLE_ACTION_TYPES,
                               node[0].db_manager.idr_cache)
    outputs = [{
        "address": SF_address,
        "amount": 30
    }, {
        "address": user1_address,
        "amount": 30
    }]
    request = helpers.request.mint(outputs)
    req_data = request.as_dict
    correct_sigs = token_authnr.authenticate(req_data)
    assert len(correct_sigs) == 3