aboutsummaryrefslogtreecommitdiffstats
path: root/AccountHolder.cpp
diff options
context:
space:
mode:
authorCJentzsch <jentzsch.software@gmail.com>2015-04-21 04:48:53 +0800
committerCJentzsch <jentzsch.software@gmail.com>2015-04-21 04:48:53 +0800
commitb2adcf3bf3a6326628b5413bddae2742073d8078 (patch)
treef02bbd0bc7841f0b37b9473a9dcacc41b542fe0f /AccountHolder.cpp
parent71012a83e86dac3a899780219a78f18acd1708c5 (diff)
downloaddexon-solidity-b2adcf3bf3a6326628b5413bddae2742073d8078.tar
dexon-solidity-b2adcf3bf3a6326628b5413bddae2742073d8078.tar.gz
dexon-solidity-b2adcf3bf3a6326628b5413bddae2742073d8078.tar.bz2
dexon-solidity-b2adcf3bf3a6326628b5413bddae2742073d8078.tar.lz
dexon-solidity-b2adcf3bf3a6326628b5413bddae2742073d8078.tar.xz
dexon-solidity-b2adcf3bf3a6326628b5413bddae2742073d8078.tar.zst
dexon-solidity-b2adcf3bf3a6326628b5413bddae2742073d8078.zip
Restructure test folders
Diffstat (limited to 'AccountHolder.cpp')
-rw-r--r--AccountHolder.cpp74
1 files changed, 0 insertions, 74 deletions
diff --git a/AccountHolder.cpp b/AccountHolder.cpp
deleted file mode 100644
index e8e42ff1..00000000
--- a/AccountHolder.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- This file is part of cpp-ethereum.
-
- cpp-ethereum is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- cpp-ethereum is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
- */
-/**
- * @author Christian R <c@ethdev.com>
- * @date 2015
- * Unit tests for the account holder used by the WebThreeStubServer.
- */
-
-#include <boost/test/unit_test.hpp>
-#include <libweb3jsonrpc/AccountHolder.h>
-
-namespace dev
-{
-namespace test
-{
-
-BOOST_AUTO_TEST_SUITE(AccountHolderTest)
-
-BOOST_AUTO_TEST_CASE(ProxyAccountUseCase)
-{
- AccountHolder h = AccountHolder(std::function<eth::Interface*()>());
- BOOST_CHECK(h.getAllAccounts().empty());
- BOOST_CHECK(h.getRealAccounts().empty());
- Address addr("abababababababababababababababababababab");
- Address addr2("abababababababababababababababababababab");
- int id = h.addProxyAccount(addr);
- BOOST_CHECK(h.getQueuedTransactions(id).empty());
- // register it again
- int secondID = h.addProxyAccount(addr);
- BOOST_CHECK(h.getQueuedTransactions(secondID).empty());
-
- eth::TransactionSkeleton t1;
- eth::TransactionSkeleton t2;
- t1.from = addr;
- t1.data = fromHex("12345678");
- t2.from = addr;
- t2.data = fromHex("abcdef");
- BOOST_CHECK(h.getQueuedTransactions(id).empty());
- h.queueTransaction(t1);
- BOOST_CHECK_EQUAL(1, h.getQueuedTransactions(id).size());
- h.queueTransaction(t2);
- BOOST_REQUIRE_EQUAL(2, h.getQueuedTransactions(id).size());
-
- // second proxy should not see transactions
- BOOST_CHECK(h.getQueuedTransactions(secondID).empty());
-
- BOOST_CHECK(h.getQueuedTransactions(id)[0].data == t1.data);
- BOOST_CHECK(h.getQueuedTransactions(id)[1].data == t2.data);
-
- h.clearQueue(id);
- BOOST_CHECK(h.getQueuedTransactions(id).empty());
- // removing fails because it never existed
- BOOST_CHECK(!h.removeProxyAccount(secondID));
- BOOST_CHECK(h.removeProxyAccount(id));
-}
-
-BOOST_AUTO_TEST_SUITE_END()
-
-}
-}