def test_nym_dynamic_validation_for_new_nym(nym_request, nym_handler: NymHandler, creator): nym_handler.write_req_validator.validate = get_exception(False) add_to_idr(nym_handler.database_manager.idr_cache, creator, STEWARD) nym_handler.dynamic_validation(nym_request) nym_handler.write_req_validator.validate = get_exception(True) with pytest.raises(UnauthorizedClientRequest): nym_handler.dynamic_validation(nym_request)
def test_nym_dynamic_validation_for_existing_nym_fails_with_no_changes( nym_handler: NymHandler, creator): nym_request = Request(identifier=creator, reqId=5, operation={ 'type': NYM, 'dest': randomString() }) add_to_idr(nym_handler.database_manager.idr_cache, nym_request.operation['dest'], None) add_to_idr(nym_handler.database_manager.idr_cache, creator, STEWARD) nym_handler.write_req_validator.validate = get_exception(True) with pytest.raises(InvalidClientRequest): nym_handler.dynamic_validation(nym_request, 0)