mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Update ripple-lib integration tests
This commit is contained in:
@@ -1,35 +1,75 @@
|
||||
var async = require("async");
|
||||
var async = require('async');
|
||||
var assert = require('assert');
|
||||
var Remote = require("ripple-lib").Remote;
|
||||
var testutils = require("./testutils");
|
||||
var Remote = require('ripple-lib').Remote;
|
||||
var testutils = require('./testutils');
|
||||
var config = testutils.init_config();
|
||||
|
||||
suite('Account set', function() {
|
||||
var $ = { };
|
||||
|
||||
setup(function(done) {
|
||||
testutils.build_setup().call($, done);
|
||||
testutils.build_setup().call($, function() {
|
||||
$.remote.local_signing = true;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
teardown(function(done) {
|
||||
testutils.build_teardown().call($, done);
|
||||
});
|
||||
|
||||
test('null AccountSet', function(done) {
|
||||
var self = this;
|
||||
|
||||
var steps = [
|
||||
function (callback) {
|
||||
self.what = 'Send null AccountSet';
|
||||
|
||||
var transaction = $.remote.transaction().accountSet('root');
|
||||
transaction.setFlags(0);
|
||||
|
||||
transaction.once('submitted', function(m) {
|
||||
assert.strictEqual(m.engine_result, 'tesSUCCESS');
|
||||
callback();
|
||||
});
|
||||
|
||||
transaction.submit();
|
||||
},
|
||||
|
||||
function (callback) {
|
||||
self.what = 'Check account flags';
|
||||
|
||||
$.remote.requestAccountFlags('root', 'CURRENT', function(err, m) {
|
||||
assert.ifError(err);
|
||||
assert.strictEqual(m, 0);
|
||||
done();
|
||||
});
|
||||
}
|
||||
]
|
||||
|
||||
async.series(steps, function(err) {
|
||||
assert(!err, self.what + ': ' + err);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('set RequireDestTag', function(done) {
|
||||
var self = this;
|
||||
|
||||
var steps = [
|
||||
function (callback) {
|
||||
self.what = "Set RequireDestTag.";
|
||||
self.what = 'Set RequireDestTag.';
|
||||
|
||||
$.remote.transaction()
|
||||
.account_set("root")
|
||||
.account_set('root')
|
||||
.set_flags('RequireDestTag')
|
||||
.on('submitted', function (m) {
|
||||
//console.log("proposed: %s", JSON.stringify(m));
|
||||
//console.log('proposed: %s', JSON.stringify(m));
|
||||
|
||||
if (m.engine_result === 'tesSUCCESS') {
|
||||
callback(null);
|
||||
} else {
|
||||
//console.log(m);
|
||||
callback(new Error(m.engine_result));
|
||||
}
|
||||
})
|
||||
@@ -37,14 +77,14 @@ suite('Account set', function() {
|
||||
},
|
||||
|
||||
function (callback) {
|
||||
self.what = "Check RequireDestTag";
|
||||
self.what = 'Check RequireDestTag';
|
||||
|
||||
$.remote.request_account_flags('root', 'CURRENT')
|
||||
.on('success', function (m) {
|
||||
var wrong = !(m.node.Flags & Remote.flags.account_root.RequireDestTag);
|
||||
|
||||
if (wrong) {
|
||||
console.log("Set RequireDestTag: failed: %s", JSON.stringify(m));
|
||||
//console.log('Set RequireDestTag: failed: %s', JSON.stringify(m));
|
||||
}
|
||||
|
||||
callback(wrong ? new Error(wrong) : null);
|
||||
@@ -53,27 +93,27 @@ suite('Account set', function() {
|
||||
},
|
||||
|
||||
function (callback) {
|
||||
self.what = "Clear RequireDestTag.";
|
||||
self.what = 'Clear RequireDestTag.';
|
||||
|
||||
$.remote.transaction()
|
||||
.account_set("root")
|
||||
.account_set('root')
|
||||
.set_flags('OptionalDestTag')
|
||||
.on('submitted', function (m) {
|
||||
//console.log("proposed: %s", JSON.stringify(m));
|
||||
callback(m.engine_result === 'tesSUCCESS' ? null : new Error());
|
||||
//console.log('proposed: %s', JSON.stringify(m));
|
||||
callback(m.engine_result === 'tesSUCCESS' ? null : m.engine_result);
|
||||
})
|
||||
.submit();
|
||||
},
|
||||
|
||||
function (callback) {
|
||||
self.what = "Check No RequireDestTag";
|
||||
self.what = 'Check No RequireDestTag';
|
||||
|
||||
$.remote.request_account_flags('root', 'CURRENT')
|
||||
.on('success', function (m) {
|
||||
var wrong = !!(m.node.Flags & Remote.flags.account_root.RequireDestTag);
|
||||
|
||||
if (wrong) {
|
||||
console.log("Clear RequireDestTag: failed: %s", JSON.stringify(m));
|
||||
console.log('Clear RequireDestTag: failed: %s', JSON.stringify(m));
|
||||
}
|
||||
|
||||
callback(wrong ? new Error(m) : null);
|
||||
@@ -83,30 +123,30 @@ suite('Account set', function() {
|
||||
]
|
||||
|
||||
async.waterfall(steps,function (error) {
|
||||
assert(!error, self.what);
|
||||
assert(!error, self.what + ': ' + error);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test("set RequireAuth", function (done) {
|
||||
test('set RequireAuth', function (done) {
|
||||
var self = this;
|
||||
|
||||
var steps = [
|
||||
function (callback) {
|
||||
self.what = "Set RequireAuth.";
|
||||
self.what = 'Set RequireAuth.';
|
||||
|
||||
$.remote.transaction()
|
||||
.account_set("root")
|
||||
.account_set('root')
|
||||
.set_flags('RequireAuth')
|
||||
.on('submitted', function (m) {
|
||||
//console.log("proposed: %s", JSON.stringify(m));
|
||||
//console.log('proposed: %s', JSON.stringify(m));
|
||||
callback(m.engine_result === 'tesSUCCESS' ? null : new Error(m));
|
||||
})
|
||||
.submit();
|
||||
},
|
||||
|
||||
function (callback) {
|
||||
self.what = "Check RequireAuth";
|
||||
self.what = 'Check RequireAuth';
|
||||
|
||||
$.remote.request_account_flags('root', 'CURRENT')
|
||||
.on('error', callback)
|
||||
@@ -114,7 +154,7 @@ suite('Account set', function() {
|
||||
var wrong = !(m.node.Flags & Remote.flags.account_root.RequireAuth);
|
||||
|
||||
if (wrong) {
|
||||
console.log("Set RequireAuth: failed: %s", JSON.stringify(m));
|
||||
console.log('Set RequireAuth: failed: %s', JSON.stringify(m));
|
||||
}
|
||||
|
||||
callback(wrong ? new Error(m) : null);
|
||||
@@ -123,13 +163,13 @@ suite('Account set', function() {
|
||||
},
|
||||
|
||||
function (callback) {
|
||||
self.what = "Clear RequireAuth.";
|
||||
self.what = 'Clear RequireAuth.';
|
||||
|
||||
$.remote.transaction()
|
||||
.account_set("root")
|
||||
.account_set('root')
|
||||
.set_flags('OptionalAuth')
|
||||
.on('submitted', function (m) {
|
||||
//console.log("proposed: %s", JSON.stringify(m));
|
||||
//console.log('proposed: %s', JSON.stringify(m));
|
||||
|
||||
callback(m.engine_result !== 'tesSUCCESS');
|
||||
})
|
||||
@@ -137,7 +177,7 @@ suite('Account set', function() {
|
||||
},
|
||||
|
||||
function (callback) {
|
||||
self.what = "Check No RequireAuth";
|
||||
self.what = 'Check No RequireAuth';
|
||||
|
||||
$.remote.request_account_flags('root', 'CURRENT')
|
||||
.on('error', callback)
|
||||
@@ -145,7 +185,7 @@ suite('Account set', function() {
|
||||
var wrong = !!(m.node.Flags & Remote.flags.account_root.RequireAuth);
|
||||
|
||||
if (wrong) {
|
||||
console.log("Clear RequireAuth: failed: %s", JSON.stringify(m));
|
||||
console.log('Clear RequireAuth: failed: %s', JSON.stringify(m));
|
||||
}
|
||||
|
||||
callback(wrong ? new Error(m) : null);
|
||||
@@ -156,7 +196,7 @@ suite('Account set', function() {
|
||||
]
|
||||
|
||||
async.waterfall(steps, function(error) {
|
||||
assert(!error, self.what);
|
||||
assert(!error, self.what + ': ' + error);
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -166,20 +206,20 @@ suite('Account set', function() {
|
||||
|
||||
var steps = [
|
||||
function (callback) {
|
||||
self.what = "Set DisallowXRP.";
|
||||
self.what = 'Set DisallowXRP.';
|
||||
|
||||
$.remote.transaction()
|
||||
.account_set("root")
|
||||
.account_set('root')
|
||||
.set_flags('DisallowXRP')
|
||||
.on('submitted', function (m) {
|
||||
//console.log("proposed: %s", JSON.stringify(m));
|
||||
//console.log('proposed: %s', JSON.stringify(m));
|
||||
callback(m.engine_result === 'tesSUCCESS' ? null : new Error(m));
|
||||
})
|
||||
.submit();
|
||||
},
|
||||
|
||||
function (callback) {
|
||||
self.what = "Check DisallowXRP";
|
||||
self.what = 'Check DisallowXRP';
|
||||
|
||||
$.remote.request_account_flags('root', 'CURRENT')
|
||||
.on('error', callback)
|
||||
@@ -187,7 +227,7 @@ suite('Account set', function() {
|
||||
var wrong = !(m.node.Flags & Remote.flags.account_root.DisallowXRP);
|
||||
|
||||
if (wrong) {
|
||||
console.log("Set RequireDestTag: failed: %s", JSON.stringify(m));
|
||||
console.log('Set RequireDestTag: failed: %s', JSON.stringify(m));
|
||||
}
|
||||
|
||||
callback(wrong ? new Error(m) : null);
|
||||
@@ -196,13 +236,13 @@ suite('Account set', function() {
|
||||
},
|
||||
|
||||
function (callback) {
|
||||
self.what = "Clear DisallowXRP.";
|
||||
self.what = 'Clear DisallowXRP.';
|
||||
|
||||
$.remote.transaction()
|
||||
.account_set("root")
|
||||
.account_set('root')
|
||||
.set_flags('AllowXRP')
|
||||
.on('submitted', function (m) {
|
||||
//console.log("proposed: %s", JSON.stringify(m));
|
||||
//console.log('proposed: %s', JSON.stringify(m));
|
||||
|
||||
callback(m.engine_result === 'tesSUCCESS' ? null : new Error(m));
|
||||
})
|
||||
@@ -210,7 +250,7 @@ suite('Account set', function() {
|
||||
},
|
||||
|
||||
function (callback) {
|
||||
self.what = "Check AllowXRP";
|
||||
self.what = 'Check AllowXRP';
|
||||
|
||||
$.remote.request_account_flags('root', 'CURRENT')
|
||||
.on('error', callback)
|
||||
@@ -218,7 +258,7 @@ suite('Account set', function() {
|
||||
var wrong = !!(m.node.Flags & Remote.flags.account_root.DisallowXRP);
|
||||
|
||||
if (wrong) {
|
||||
console.log("Clear DisallowXRP: failed: %s", JSON.stringify(m));
|
||||
console.log('Clear DisallowXRP: failed: %s', JSON.stringify(m));
|
||||
}
|
||||
|
||||
callback(wrong ? new Error(m) : null);
|
||||
|
||||
Reference in New Issue
Block a user