From 2d9ceca5f14f8a1bcab0894a08555b423191f097 Mon Sep 17 00:00:00 2001 From: Diego Garcia Date: Wed, 22 Nov 2017 12:30:09 +0100 Subject: [PATCH 1/2] Decouple unconfirmed phase from functional test tx type 1 --- .../http/post/1.X.unconfirmed/1.0.transfer.js | 36 +++++ .../post/1.X.unconfirmed/1.1.second.secret.js | 36 +++++ .../http/post/1.X.unconfirmed/1.2.delegate.js | 36 +++++ .../http/post/1.X.unconfirmed/1.3.votes.js | 36 +++++ .../http/post/1.X.unconfirmed/1.4.multisig.js | 36 +++++ .../http/post/1.X.unconfirmed/1.5.dapps.js | 36 +++++ .../1.X.unconfirmed/1.6.dapps.inTransfer.js | 36 +++++ .../1.X.unconfirmed/1.7.dapps.outTransfer.js | 36 +++++ .../http/post/1.X.unconfirmed/shared.js | 74 ++++++++++ .../http/post/1.X.validation/1.0.transfer.js | 2 +- .../post/1.X.validation/1.1.second.secret.js | 2 +- .../http/post/1.X.validation/1.2.delegate.js | 2 +- .../http/post/1.X.validation/1.3.votes.js | 2 +- .../http/post/1.X.validation/1.4.multisig.js | 2 +- .../http/post/1.X.validation/1.5.dapps.js | 2 +- .../1.X.validation/1.6.dapps.inTransfer.js | 2 +- .../1.X.validation/1.7.dapps.outTransfer.js | 2 +- test/functional/http/post/1.second.secret.js | 134 +----------------- test/functional/http/post/index.js | 9 ++ 19 files changed, 380 insertions(+), 141 deletions(-) create mode 100644 test/functional/http/post/1.X.unconfirmed/1.0.transfer.js create mode 100644 test/functional/http/post/1.X.unconfirmed/1.1.second.secret.js create mode 100644 test/functional/http/post/1.X.unconfirmed/1.2.delegate.js create mode 100644 test/functional/http/post/1.X.unconfirmed/1.3.votes.js create mode 100644 test/functional/http/post/1.X.unconfirmed/1.4.multisig.js create mode 100644 test/functional/http/post/1.X.unconfirmed/1.5.dapps.js create mode 100644 test/functional/http/post/1.X.unconfirmed/1.6.dapps.inTransfer.js create mode 100644 test/functional/http/post/1.X.unconfirmed/1.7.dapps.outTransfer.js create mode 100644 test/functional/http/post/1.X.unconfirmed/shared.js diff --git a/test/functional/http/post/1.X.unconfirmed/1.0.transfer.js b/test/functional/http/post/1.X.unconfirmed/1.0.transfer.js new file mode 100644 index 00000000000..bae5595c523 --- /dev/null +++ b/test/functional/http/post/1.X.unconfirmed/1.0.transfer.js @@ -0,0 +1,36 @@ +'use strict'; + +var node = require('../../../../node'); +var shared = require('../../../shared'); +var localShared = require('./shared'); + +var sendTransactionPromise = require('../../../../common/apiHelpers').sendTransactionPromise; + +describe('POST /api/transactions (unconfirmed type 0 on top of type 1)', function () { + + var transaction; + var badTransactions = []; + var goodTransactions = []; + + var account = node.randomAccount(); + + localShared.beforeUnconfirmedPhase(account); + + describe('sending funds', function () { + + it('using second signature with an account that has a pending second passphrase registration should fail', function () { + transaction = node.lisk.transaction.createTransaction(node.randomAccount().address, 1, account.password, account.secondPassword); + + return sendTransactionPromise(transaction).then(function (res) { + node.expect(res).to.have.property('status').to.equal(400); + node.expect(res).to.have.nested.property('body.message').to.equal('Sender does not have a second signature'); + badTransactions.push(transaction); + }); + }); + }); + + describe('confirmation', function () { + + shared.confirmationPhase(goodTransactions, badTransactions); + }); +}); diff --git a/test/functional/http/post/1.X.unconfirmed/1.1.second.secret.js b/test/functional/http/post/1.X.unconfirmed/1.1.second.secret.js new file mode 100644 index 00000000000..0558c6ecb8b --- /dev/null +++ b/test/functional/http/post/1.X.unconfirmed/1.1.second.secret.js @@ -0,0 +1,36 @@ +'use strict'; + +var node = require('../../../../node'); +var shared = require('../../../shared'); +var localShared = require('./shared'); + +var sendTransactionPromise = require('../../../../common/apiHelpers').sendTransactionPromise; + +describe('POST /api/transactions (unconfirmed type 1 on top of type 1)', function () { + + var transaction; + var badTransactions = []; + var goodTransactions = []; + + var account = node.randomAccount(); + + localShared.beforeUnconfirmedPhase(account); + + describe('registering second secret', function () { + + it('duplicate submission should be ok and only last transaction to arrive should be confirmed', function () { + transaction = node.lisk.signature.createSignature(account.password, 'secondpassword'); + + return sendTransactionPromise(transaction).then(function (res) { + node.expect(res).to.have.property('status').to.equal(200); + node.expect(res).to.have.nested.property('body.status').to.equal('Transaction(s) accepted'); + goodTransactions.push(transaction); + }); + }); + }); + + describe('confirmation', function () { + + shared.confirmationPhase(goodTransactions, badTransactions); + }); +}); diff --git a/test/functional/http/post/1.X.unconfirmed/1.2.delegate.js b/test/functional/http/post/1.X.unconfirmed/1.2.delegate.js new file mode 100644 index 00000000000..021d052a1ce --- /dev/null +++ b/test/functional/http/post/1.X.unconfirmed/1.2.delegate.js @@ -0,0 +1,36 @@ +'use strict'; + +var node = require('../../../../node'); +var shared = require('../../../shared'); +var localShared = require('./shared'); + +var sendTransactionPromise = require('../../../../common/apiHelpers').sendTransactionPromise; + +describe('POST /api/transactions (unconfirmed type 2 on top of type 1)', function () { + + var transaction; + var badTransactions = []; + var goodTransactions = []; + + var account = node.randomAccount(); + + localShared.beforeUnconfirmedPhase(account); + + describe('registering delegate', function () { + + it('using second signature with an account that has a pending second passphrase registration should fail', function () { + transaction = node.lisk.delegate.createDelegate(account.password, account.username, account.secondPassword); + + return sendTransactionPromise(transaction).then(function (res) { + node.expect(res).to.have.property('status').to.equal(400); + node.expect(res).to.have.nested.property('body.message').to.equal('Sender does not have a second signature'); + badTransactions.push(transaction); + }); + }); + }); + + describe('confirmation', function () { + + shared.confirmationPhase(goodTransactions, badTransactions); + }); +}); diff --git a/test/functional/http/post/1.X.unconfirmed/1.3.votes.js b/test/functional/http/post/1.X.unconfirmed/1.3.votes.js new file mode 100644 index 00000000000..5fb19319122 --- /dev/null +++ b/test/functional/http/post/1.X.unconfirmed/1.3.votes.js @@ -0,0 +1,36 @@ +'use strict'; + +var node = require('../../../../node'); +var shared = require('../../../shared'); +var localShared = require('./shared'); + +var sendTransactionPromise = require('../../../../common/apiHelpers').sendTransactionPromise; + +describe('POST /api/transactions (unconfirmed type 3 on top of type 1)', function () { + + var transaction; + var badTransactions = []; + var goodTransactions = []; + + var account = node.randomAccount(); + + localShared.beforeUnconfirmedPhase(account); + + describe('voting delegate', function () { + + it('using second signature with an account that has a pending second passphrase registration should fail', function () { + transaction = node.lisk.vote.createVote(account.password, ['+' + node.eAccount.publicKey], account.secondPassword); + + return sendTransactionPromise(transaction).then(function (res) { + node.expect(res).to.have.property('status').to.equal(400); + node.expect(res).to.have.nested.property('body.message').to.equal('Sender does not have a second signature'); + badTransactions.push(transaction); + }); + }); + }); + + describe('confirmation', function () { + + shared.confirmationPhase(goodTransactions, badTransactions); + }); +}); diff --git a/test/functional/http/post/1.X.unconfirmed/1.4.multisig.js b/test/functional/http/post/1.X.unconfirmed/1.4.multisig.js new file mode 100644 index 00000000000..0c7d80ff600 --- /dev/null +++ b/test/functional/http/post/1.X.unconfirmed/1.4.multisig.js @@ -0,0 +1,36 @@ +'use strict'; + +var node = require('../../../../node'); +var shared = require('../../../shared'); +var localShared = require('./shared'); + +var sendTransactionPromise = require('../../../../common/apiHelpers').sendTransactionPromise; + +describe('POST /api/transactions (unconfirmed type 4 on top of type 1)', function () { + + var transaction; + var badTransactions = []; + var goodTransactions = []; + + var account = node.randomAccount(); + + localShared.beforeUnconfirmedPhase(account); + + describe('creating multisig', function () { + + it('using second signature with an account that has a pending second passphrase registration should fail', function () { + transaction = node.lisk.multisignature.createMultisignature(account.password, account.secondPassword, ['+' + node.eAccount.publicKey], 1, 1); + + return sendTransactionPromise(transaction).then(function (res) { + node.expect(res).to.have.property('status').to.equal(400); + node.expect(res).to.have.nested.property('body.message').to.equal('Sender does not have a second signature'); + badTransactions.push(transaction); + }); + }); + }); + + describe('confirmation', function () { + + shared.confirmationPhase(goodTransactions, badTransactions); + }); +}); diff --git a/test/functional/http/post/1.X.unconfirmed/1.5.dapps.js b/test/functional/http/post/1.X.unconfirmed/1.5.dapps.js new file mode 100644 index 00000000000..1afaa71ab94 --- /dev/null +++ b/test/functional/http/post/1.X.unconfirmed/1.5.dapps.js @@ -0,0 +1,36 @@ +'use strict'; + +var node = require('../../../../node'); +var shared = require('../../../shared'); +var localShared = require('./shared'); + +var sendTransactionPromise = require('../../../../common/apiHelpers').sendTransactionPromise; + +describe('POST /api/transactions (unconfirmed type 5 on top of type 1)', function () { + + var transaction; + var badTransactions = []; + var goodTransactions = []; + + var account = node.randomAccount(); + + localShared.beforeUnconfirmedPhase(account); + + describe('registering dapp', function () { + + it('using second signature with an account that has a pending second passphrase registration should fail', function () { + transaction = node.lisk.dapp.createDapp(account.password, account.secondPassword, node.randomApplication()); + + return sendTransactionPromise(transaction).then(function (res) { + node.expect(res).to.have.property('status').to.equal(400); + node.expect(res).to.have.nested.property('body.message').to.equal('Sender does not have a second signature'); + badTransactions.push(transaction); + }); + }); + }); + + describe('confirmation', function () { + + shared.confirmationPhase(goodTransactions, badTransactions); + }); +}); diff --git a/test/functional/http/post/1.X.unconfirmed/1.6.dapps.inTransfer.js b/test/functional/http/post/1.X.unconfirmed/1.6.dapps.inTransfer.js new file mode 100644 index 00000000000..d4264c2b32f --- /dev/null +++ b/test/functional/http/post/1.X.unconfirmed/1.6.dapps.inTransfer.js @@ -0,0 +1,36 @@ +'use strict'; + +var node = require('../../../../node'); +var shared = require('../../../shared'); +var localShared = require('./shared'); + +var sendTransactionPromise = require('../../../../common/apiHelpers').sendTransactionPromise; + +describe('POST /api/transactions (unconfirmed type 6 on top of type 1)', function () { + + var transaction; + var badTransactions = []; + var goodTransactions = []; + + var account = node.randomAccount(); + + localShared.beforeUnconfirmedPhaseWithDapp(account); + + describe('inTransfer', function () { + + it('using second signature with an account that has a pending second passphrase registration should fail', function () { + transaction = node.lisk.transfer.createInTransfer(node.guestbookDapp.transactionId, 10 * node.normalizer, account.password, account.secondPassword); + + return sendTransactionPromise(transaction).then(function (res) { + node.expect(res).to.have.property('status').to.equal(400); + node.expect(res).to.have.nested.property('body.message').to.equal('Sender does not have a second signature'); + badTransactions.push(transaction); + }); + }); + }); + + describe('confirmation', function () { + + shared.confirmationPhase(goodTransactions, badTransactions); + }); +}); diff --git a/test/functional/http/post/1.X.unconfirmed/1.7.dapps.outTransfer.js b/test/functional/http/post/1.X.unconfirmed/1.7.dapps.outTransfer.js new file mode 100644 index 00000000000..c2ac45be62d --- /dev/null +++ b/test/functional/http/post/1.X.unconfirmed/1.7.dapps.outTransfer.js @@ -0,0 +1,36 @@ +'use strict'; + +var node = require('../../../../node'); +var shared = require('../../../shared'); +var localShared = require('./shared'); + +var sendTransactionPromise = require('../../../../common/apiHelpers').sendTransactionPromise; + +describe('POST /api/transactions (unconfirmed type 7 on top of type 1)', function () { + + var transaction; + var badTransactions = []; + var goodTransactions = []; + + var account = node.randomAccount(); + + localShared.beforeUnconfirmedPhaseWithDapp(account); + + describe('outTransfer', function () { + + it('using second signature with an account that has a pending second passphrase registration should fail', function () { + transaction = node.lisk.transfer.createOutTransfer(node.guestbookDapp.transactionId, node.randomTransaction().id, node.randomAccount().address, 10 * node.normalizer, account.password, account.secondPassword); + + return sendTransactionPromise(transaction).then(function (res) { + node.expect(res).to.have.property('status').to.equal(400); + node.expect(res).to.have.nested.property('body.message').to.equal('Sender does not have a second signature'); + badTransactions.push(transaction); + }); + }); + }); + + describe('confirmation', function () { + + shared.confirmationPhase(goodTransactions, badTransactions); + }); +}); diff --git a/test/functional/http/post/1.X.unconfirmed/shared.js b/test/functional/http/post/1.X.unconfirmed/shared.js new file mode 100644 index 00000000000..01ae91df3aa --- /dev/null +++ b/test/functional/http/post/1.X.unconfirmed/shared.js @@ -0,0 +1,74 @@ +'use strict'; + +var node = require('../../../../node'); +var shared = require('../../../shared'); + +var sendTransactionPromise = require('../../../../common/apiHelpers').sendTransactionPromise; +var waitForConfirmations = require('../../../../common/apiHelpers').waitForConfirmations; + +function beforeUnconfirmedPhase (account) { + + before(function () { + var transaction = node.lisk.transaction.createTransaction(account.address, 1000 * node.normalizer, node.gAccount.password); + + return sendTransactionPromise(transaction) + .then(function (res) { + node.expect(res).to.have.property('status').to.equal(200); + node.expect(res).to.have.nested.property('body.status').that.is.equal('Transaction(s) accepted'); + + return waitForConfirmations([transaction.id]); + }) + .then(function () { + transaction = node.lisk.signature.createSignature(account.password, account.secondPassword, 1); + + return sendTransactionPromise(transaction); + }) + .then(function (res) { + node.expect(res).to.have.property('status').to.equal(200); + node.expect(res).to.have.nested.property('body.status').to.equal('Transaction(s) accepted'); + }); + }); +}; + +function beforeUnconfirmedPhaseWithDapp (account) { + + before(function () { + var transaction = node.lisk.transaction.createTransaction(account.address, 1000 * node.normalizer, node.gAccount.password); + + return sendTransactionPromise(transaction) + .then(function (res) { + node.expect(res).to.have.property('status').to.equal(200); + node.expect(res).to.have.nested.property('body.status').that.is.equal('Transaction(s) accepted'); + + return waitForConfirmations([transaction.id]); + }) + .then(function () { + transaction = node.lisk.dapp.createDapp(account.password, null, node.guestbookDapp); + + return sendTransactionPromise(transaction); + }) + .then(function (res) { + node.expect(res).to.have.property('status').to.equal(200); + node.expect(res).to.have.nested.property('body.status').to.equal('Transaction(s) accepted'); + + node.guestbookDapp.transactionId = transaction.id; + + return waitForConfirmations([transaction.id]); + }) + .then(function (res) { + transaction = node.lisk.signature.createSignature(account.password, account.secondPassword, 1); + + return sendTransactionPromise(transaction); + }) + .then(function (res) { + node.expect(res).to.have.property('status').to.equal(200); + node.expect(res).to.have.nested.property('body.status').to.equal('Transaction(s) accepted'); + }); + }); +}; + + +module.exports = { + beforeUnconfirmedPhase: beforeUnconfirmedPhase, + beforeUnconfirmedPhaseWithDapp: beforeUnconfirmedPhaseWithDapp +}; diff --git a/test/functional/http/post/1.X.validation/1.0.transfer.js b/test/functional/http/post/1.X.validation/1.0.transfer.js index 3e46d35b547..d8c2f8a7003 100644 --- a/test/functional/http/post/1.X.validation/1.0.transfer.js +++ b/test/functional/http/post/1.X.validation/1.0.transfer.js @@ -6,7 +6,7 @@ var localShared = require('./shared'); var sendTransactionPromise = require('../../../../common/apiHelpers').sendTransactionPromise; -describe('POST /api/transactions (type 0 on top of type 1)', function () { +describe('POST /api/transactions (validate type 0 on top of type 1)', function () { var transaction; var badTransactions = []; diff --git a/test/functional/http/post/1.X.validation/1.1.second.secret.js b/test/functional/http/post/1.X.validation/1.1.second.secret.js index c6a2f462e3f..f9ff71e7b74 100644 --- a/test/functional/http/post/1.X.validation/1.1.second.secret.js +++ b/test/functional/http/post/1.X.validation/1.1.second.secret.js @@ -6,7 +6,7 @@ var localShared = require('./shared'); var sendTransactionPromise = require('../../../../common/apiHelpers').sendTransactionPromise; -describe('POST /api/transactions (type 1 on top of type 1)', function () { +describe('POST /api/transactions (validate type 1 on top of type 1)', function () { var transaction; var badTransactions = []; diff --git a/test/functional/http/post/1.X.validation/1.2.delegate.js b/test/functional/http/post/1.X.validation/1.2.delegate.js index 11ff3f320f6..5891764c124 100644 --- a/test/functional/http/post/1.X.validation/1.2.delegate.js +++ b/test/functional/http/post/1.X.validation/1.2.delegate.js @@ -6,7 +6,7 @@ var localShared = require('./shared'); var sendTransactionPromise = require('../../../../common/apiHelpers').sendTransactionPromise; -describe('POST /api/transactions (type 2 on top of type 1)', function () { +describe('POST /api/transactions (validate type 2 on top of type 1)', function () { var transaction; var badTransactions = []; diff --git a/test/functional/http/post/1.X.validation/1.3.votes.js b/test/functional/http/post/1.X.validation/1.3.votes.js index 4678affd15b..b0787082849 100644 --- a/test/functional/http/post/1.X.validation/1.3.votes.js +++ b/test/functional/http/post/1.X.validation/1.3.votes.js @@ -6,7 +6,7 @@ var localShared = require('./shared'); var sendTransactionPromise = require('../../../../common/apiHelpers').sendTransactionPromise; -describe('POST /api/transactions (type 3 on top of type 1)', function () { +describe('POST /api/transactions (validate type 3 on top of type 1)', function () { var transaction; var badTransactions = []; diff --git a/test/functional/http/post/1.X.validation/1.4.multisig.js b/test/functional/http/post/1.X.validation/1.4.multisig.js index 06571279e65..f709395e7c7 100644 --- a/test/functional/http/post/1.X.validation/1.4.multisig.js +++ b/test/functional/http/post/1.X.validation/1.4.multisig.js @@ -7,7 +7,7 @@ var localShared = require('./shared'); var sendTransactionPromise = require('../../../../common/apiHelpers').sendTransactionPromise; var sendSignaturePromise = require('../../../../common/apiHelpers').sendSignaturePromise; -describe('POST /api/transactions (type 4 on top of type 1)', function () { +describe('POST /api/transactions (validate type 4 on top of type 1)', function () { var transaction, signature; var badTransactions = []; diff --git a/test/functional/http/post/1.X.validation/1.5.dapps.js b/test/functional/http/post/1.X.validation/1.5.dapps.js index c39030f58ae..7b5ed8ae9db 100644 --- a/test/functional/http/post/1.X.validation/1.5.dapps.js +++ b/test/functional/http/post/1.X.validation/1.5.dapps.js @@ -6,7 +6,7 @@ var localShared = require('./shared'); var sendTransactionPromise = require('../../../../common/apiHelpers').sendTransactionPromise; -describe('POST /api/transactions (type 5 on top of type 1)', function () { +describe('POST /api/transactions (validate type 5 on top of type 1)', function () { var transaction; var badTransactions = []; diff --git a/test/functional/http/post/1.X.validation/1.6.dapps.inTransfer.js b/test/functional/http/post/1.X.validation/1.6.dapps.inTransfer.js index 979e45685ba..6eb4f5541f4 100644 --- a/test/functional/http/post/1.X.validation/1.6.dapps.inTransfer.js +++ b/test/functional/http/post/1.X.validation/1.6.dapps.inTransfer.js @@ -7,7 +7,7 @@ var localShared = require('./shared'); var sendTransactionPromise = require('../../../../common/apiHelpers').sendTransactionPromise; var waitForConfirmations = require('../../../../common/apiHelpers').waitForConfirmations; -describe('POST /api/transactions (type 6 on top of type 1)', function () { +describe('POST /api/transactions (validate type 6 on top of type 1)', function () { var transaction; var badTransactions = []; diff --git a/test/functional/http/post/1.X.validation/1.7.dapps.outTransfer.js b/test/functional/http/post/1.X.validation/1.7.dapps.outTransfer.js index 0aba2d58a94..cd35fdf9dd0 100644 --- a/test/functional/http/post/1.X.validation/1.7.dapps.outTransfer.js +++ b/test/functional/http/post/1.X.validation/1.7.dapps.outTransfer.js @@ -7,7 +7,7 @@ var localShared = require('./shared'); var sendTransactionPromise = require('../../../../common/apiHelpers').sendTransactionPromise; var waitForConfirmations = require('../../../../common/apiHelpers').waitForConfirmations; -describe('POST /api/transactions (type 7 on top of type 1)', function () { +describe('POST /api/transactions (validate type 7 on top of type 1)', function () { var transaction; var badTransactions = []; diff --git a/test/functional/http/post/1.second.secret.js b/test/functional/http/post/1.second.secret.js index 822911cd613..1d33ab45b27 100644 --- a/test/functional/http/post/1.second.secret.js +++ b/test/functional/http/post/1.second.secret.js @@ -18,20 +18,17 @@ describe('POST /api/transactions (type 1) register second secret', function () { var accountNoFunds = node.randomAccount(); var accountMinimalFunds = node.randomAccount(); var accountNoSecondPassword = node.randomAccount(); - var accountDuplicate = node.randomAccount(); // Crediting accounts before(function () { var transaction1 = node.lisk.transaction.createTransaction(account.address, 1000 * node.normalizer, node.gAccount.password); var transaction2 = node.lisk.transaction.createTransaction(accountMinimalFunds.address, constants.fees.secondSignature, node.gAccount.password); var transaction3 = node.lisk.transaction.createTransaction(accountNoSecondPassword.address, constants.fees.secondSignature, node.gAccount.password); - var transaction4 = node.lisk.transaction.createTransaction(accountDuplicate.address, constants.fees.secondSignature, node.gAccount.password); var promises = []; promises.push(sendTransactionPromise(transaction1)); promises.push(sendTransactionPromise(transaction2)); promises.push(sendTransactionPromise(transaction3)); - promises.push(sendTransactionPromise(transaction4)); return node.Promise.all(promises) .then(function (results) { @@ -40,21 +37,7 @@ describe('POST /api/transactions (type 1) register second secret', function () { node.expect(res).to.have.nested.property('body.status').that.is.equal('Transaction(s) accepted'); }); - transactionsToWaitFor.push(transaction1.id, transaction2.id, transaction3.id, transaction4.id); - return waitForConfirmations(transactionsToWaitFor); - }) - .then(function () { - transaction = node.lisk.dapp.createDapp(account.password, null, node.guestbookDapp); - - return sendTransactionPromise(transaction); - }) - .then(function (res) { - node.expect(res).to.have.property('status').to.equal(200); - node.expect(res).to.have.nested.property('body.status').to.equal('Transaction(s) accepted'); - goodTransactions.push(transaction); - node.guestbookDapp.transactionId = transaction.id; - - transactionsToWaitFor.push(transaction.id); + transactionsToWaitFor.push(transaction1.id, transaction2.id, transaction3.id); return waitForConfirmations(transactionsToWaitFor); }); }); @@ -107,121 +90,6 @@ describe('POST /api/transactions (type 1) register second secret', function () { }); }); - describe('unconfirmed state', function () { - - describe('type 0 - sending funds', function () { - - it('using second signature with an account that has a pending second passphrase registration should fail', function () { - transaction = node.lisk.transaction.createTransaction(node.eAccount.address, 1, account.password, account.secondPassword); - - return sendTransactionPromise(transaction).then(function (res) { - node.expect(res).to.have.property('status').to.equal(400); - node.expect(res).to.have.nested.property('body.message').to.equal('Sender does not have a second signature'); - badTransactions.push(transaction); - }); - }); - }); - - describe('type 1 - second secret', function () { - - it('with valid params and duplicate submission should be ok and only last transaction to arrive should be confirmed', function () { - transaction = node.lisk.signature.createSignature(accountDuplicate.password, 'secondpassword'); - - return sendTransactionPromise(transaction).then(function (res) { - node.expect(res).to.have.property('status').to.equal(200); - node.expect(res).to.have.nested.property('body.status').to.equal('Transaction(s) accepted'); - badTransactions.push(transaction); - - transaction = node.lisk.signature.createSignature(accountDuplicate.password, accountDuplicate.secondPassword); - - return sendTransactionPromise(transaction).then(function (res) { - node.expect(res).to.have.property('status').to.equal(200); - node.expect(res).to.have.nested.property('body.status').to.equal('Transaction(s) accepted'); - goodTransactions.push(transaction); - }); - }); - }); - }); - - describe('type 2 - registering delegate', function () { - - it('using second signature with an account that has a pending second passphrase registration should fail', function () { - transaction = node.lisk.delegate.createDelegate(account.password, account.username, account.secondPassword); - - return sendTransactionPromise(transaction).then(function (res) { - node.expect(res).to.have.property('status').to.equal(400); - node.expect(res).to.have.nested.property('body.message').to.equal('Sender does not have a second signature'); - badTransactions.push(transaction); - }); - }); - }); - - describe('type 3 - voting delegate', function () { - - it('using second signature with an account that has a pending second passphrase registration should fail', function () { - transaction = node.lisk.vote.createVote(account.password, ['+' + node.eAccount.publicKey], account.secondPassword); - - return sendTransactionPromise(transaction).then(function (res) { - node.expect(res).to.have.property('status').to.equal(400); - node.expect(res).to.have.nested.property('body.message').to.equal('Sender does not have a second signature'); - badTransactions.push(transaction); - }); - }); - }); - - describe('type 4 - registering multisignature account', function () { - - it('using second signature with an account that has a pending second passphrase registration should fail', function () { - transaction = node.lisk.multisignature.createMultisignature(account.password, account.secondPassword, ['+' + node.eAccount.publicKey, '+' + accountNoFunds.publicKey], 1, 2); - - return sendTransactionPromise(transaction).then(function (res) { - node.expect(res).to.have.property('status').to.equal(400); - node.expect(res).to.have.nested.property('body.message').to.equal('Sender does not have a second signature'); - badTransactions.push(transaction); - }); - }); - }); - - describe('type 5 - registering dapp', function () { - - it('using second signature with an account that has a pending second passphrase registration should fail', function () { - transaction = node.lisk.dapp.createDapp(account.password, account.secondPassword, node.randomApplication()); - - return sendTransactionPromise(transaction).then(function (res) { - node.expect(res).to.have.property('status').to.equal(400); - node.expect(res).to.have.nested.property('body.message').to.equal('Sender does not have a second signature'); - badTransactions.push(transaction); - }); - }); - }); - - describe('type 6 - inTransfer', function () { - - it('using second signature with an account that has a pending second passphrase registration should fail', function () { - transaction = node.lisk.transfer.createInTransfer(node.guestbookDapp.transactionId, 10 * node.normalizer, account.password, account.secondPassword); - - return sendTransactionPromise(transaction).then(function (res) { - node.expect(res).to.have.property('status').to.equal(400); - node.expect(res).to.have.nested.property('body.message').to.equal('Sender does not have a second signature'); - badTransactions.push(transaction); - }); - }); - }); - - describe('type 7 - outTransfer', function () { - - it('using second signature with an account that has a pending second passphrase registration should fail', function () { - transaction = node.lisk.transfer.createOutTransfer(node.guestbookDapp.transactionId, node.randomTransaction().id, node.randomAccount().address, 10 * node.normalizer, account.password, account.secondPassword); - - return sendTransactionPromise(transaction).then(function (res) { - node.expect(res).to.have.property('status').to.equal(400); - node.expect(res).to.have.nested.property('body.message').to.equal('Sender does not have a second signature'); - badTransactions.push(transaction); - }); - }); - }); - }); - describe('confirmation', function () { shared.confirmationPhase(goodTransactions, badTransactions); diff --git a/test/functional/http/post/index.js b/test/functional/http/post/index.js index d8f9c319c76..e666234506a 100644 --- a/test/functional/http/post/index.js +++ b/test/functional/http/post/index.js @@ -12,6 +12,15 @@ var pathFiles = [ './6.dapps.inTransfer', './7.dapps.outTransfer', + './1.X.unconfirmed/1.0.transfer', + './1.X.unconfirmed/1.1.second.secret', + './1.X.unconfirmed/1.2.delegate', + './1.X.unconfirmed/1.3.votes', + './1.X.unconfirmed/1.4.multisig', + './1.X.unconfirmed/1.5.dapps', + './1.X.unconfirmed/1.6.dapps.inTransfer', + './1.X.unconfirmed/1.7.dapps.outTransfer', + './1.X.validation/1.0.transfer', './1.X.validation/1.1.second.secret', './1.X.validation/1.2.delegate', From 3d6202ea86099a539c4289ea29fab80907c29be8 Mon Sep 17 00:00:00 2001 From: Oliver Beddows Date: Wed, 22 Nov 2017 20:01:12 +0100 Subject: [PATCH 2/2] Standardise spacing --- test/functional/http/post/1.X.unconfirmed/shared.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/functional/http/post/1.X.unconfirmed/shared.js b/test/functional/http/post/1.X.unconfirmed/shared.js index 01ae91df3aa..c6f1e74c56e 100644 --- a/test/functional/http/post/1.X.unconfirmed/shared.js +++ b/test/functional/http/post/1.X.unconfirmed/shared.js @@ -7,7 +7,6 @@ var sendTransactionPromise = require('../../../../common/apiHelpers').sendTransa var waitForConfirmations = require('../../../../common/apiHelpers').waitForConfirmations; function beforeUnconfirmedPhase (account) { - before(function () { var transaction = node.lisk.transaction.createTransaction(account.address, 1000 * node.normalizer, node.gAccount.password); @@ -31,7 +30,6 @@ function beforeUnconfirmedPhase (account) { }; function beforeUnconfirmedPhaseWithDapp (account) { - before(function () { var transaction = node.lisk.transaction.createTransaction(account.address, 1000 * node.normalizer, node.gAccount.password); @@ -67,7 +65,6 @@ function beforeUnconfirmedPhaseWithDapp (account) { }); }; - module.exports = { beforeUnconfirmedPhase: beforeUnconfirmedPhase, beforeUnconfirmedPhaseWithDapp: beforeUnconfirmedPhaseWithDapp