Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ripple-lib integration tests #413

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},

"dependencies": {
"ripple-lib": "0.7.25",
"ripple-lib": "0.7.37",
"async": "~0.2.9",
"extend": "~1.2.0",
"simple-jsonrpc": "~0.0.2",
Expand All @@ -31,4 +31,4 @@
},

"readmeFilename": "README.md"
}
}
116 changes: 78 additions & 38 deletions test/account_set-test.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,90 @@
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));
}
})
.submit();
},

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);
Expand All @@ -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);
Expand All @@ -83,38 +123,38 @@ 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)
.on('success', function (m) {
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);
Expand All @@ -123,29 +163,29 @@ 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');
})
.submit();
},

function (callback) {
self.what = "Check No RequireAuth";
self.what = 'Check No RequireAuth';

$.remote.request_account_flags('root', 'CURRENT')
.on('error', callback)
.on('success', function (m) {
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);
Expand All @@ -156,7 +196,7 @@ suite('Account set', function() {
]

async.waterfall(steps, function(error) {
assert(!error, self.what);
assert(!error, self.what + ': ' + error);
done();
});
});
Expand All @@ -166,28 +206,28 @@ 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)
.on('success', function (m) {
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);
Expand All @@ -196,29 +236,29 @@ 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));
})
.submit();
},

function (callback) {
self.what = "Check AllowXRP";
self.what = 'Check AllowXRP';

$.remote.request_account_flags('root', 'CURRENT')
.on('error', callback)
.on('success', function (m) {
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);
Expand Down
7 changes: 4 additions & 3 deletions test/config-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ exports.default_server_config = {
exports.servers = {
// A local test server.
"alpha" : {
//'trace': true,
'websocket_ip': "127.0.0.1",
'websocket_port': 5006,
'websocket_ssl': false,
'trusted' : true,
// "peer_ip" : "0.0.0.0",
// "peer_port" : 51235,
'rpc_ip' : "0.0.0.0",
'rpc_port' : 5005,
'websocket_ip' : "127.0.0.1",
'websocket_port' : 5006,
'websocket_ssl' : false,
'local_sequence' : true,
'local_fee' : true,
// 'validation_seed' : "shhDFVsmS2GSu5vUyZSPXYfj1r79h",
Expand Down
Loading