Add test explorerAddress, explorerSpendingTx, explorerBlocks

pull/79/head
Martin Boehm 2018-10-18 17:57:08 +02:00
parent d7ed48a657
commit 9fd647014a
2 changed files with 51 additions and 3 deletions

View File

@ -134,8 +134,56 @@ func Test_PublicServer_UTXO(t *testing.T) {
`</html>`,
},
},
// explorerSpendingTx
// explorerBlocks
{
name: "explorerAddress",
r: newGetRequest(ts.URL+"/address/mtGXQvBowMkBpnhLckhxhbwYK44Gs9eEtz", nil),
status: http.StatusOK,
contentType: "text/html; charset=utf-8",
body: []string{
`<a href="/" class="nav-link">Bitcoin Testnet Explorer</a>`,
`<h1>Address`,
`<small class="text-muted">0 TEST</small>`,
`<span class="data">mtGXQvBowMkBpnhLckhxhbwYK44Gs9eEtz</span>`,
`<td class="data">0.00012345 TEST</td>`,
`<a href="/tx/7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25">7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25</a>`,
`3172.83951061 TEST <a class="text-danger" href="/spending/7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25/0" title="Spent">➡</a></span>`,
`<td><span class="ellipsis float-left"><a href="/address/mtR97eM2HPWVM6c8FGLGcukgaHHQv7THoL">mtR97eM2HPWVM6c8FGLGcukgaHHQv7THoL</a></span><span class="float-right">`,
`td><span class="ellipsis float-left"><a href="/address/mtR97eM2HPWVM6c8FGLGcukgaHHQv7THoL">mtR97eM2HPWVM6c8FGLGcukgaHHQv7THoL</a></span><span class="float-right">`,
`9172.83951061 TEST <span class="text-success" title="Unspent"> <b>×</b></span></span>`,
`<a href="/tx/00b2c06055e5e90e9c82bd4181fde310104391a7fa4f289b1704e5d90caa3840">00b2c06055e5e90e9c82bd4181fde310104391a7fa4f289b1704e5d90caa3840</a>`,
`</html>`,
},
},
{
name: "explorerSpendingTx",
r: newGetRequest(ts.URL+"/spending/7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25/0", nil),
status: http.StatusOK,
contentType: "text/html; charset=utf-8",
body: []string{
`<a href="/" class="nav-link">Bitcoin Testnet Explorer</a>`,
`<h1>Transaction</h1>`,
`<span class="data">3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71</span>`,
`<td class="data">0.00000062 TEST</td>`,
`</html>`,
},
},
{
name: "explorerBlocks",
r: newGetRequest(ts.URL+"/blocks", nil),
status: http.StatusOK,
contentType: "text/html; charset=utf-8",
body: []string{
`<a href="/" class="nav-link">Bitcoin Testnet Explorer</a>`,
`<h1>Blocks`,
`<td><a href="/block/225494">225494</a></td>`,
`<td class="ellipsis">00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6</td>`,
`<td class="ellipsis">0000000076fbbed90fd75b0e18856aa35baa984e9c9d444cf746ad85e94e2997</td>`,
`<td>Tue, 21 Aug 2018 15:27:01 CEST</td>`,
`<td class="text-right">2</td>`,
`<td class="text-right">1234567</td>`,
`</html>`,
},
},
{
name: "explorerBlock",
r: newGetRequest(ts.URL+"/block/225494", nil),

View File

@ -178,7 +178,7 @@ func (c *fakeBlockChain) GetMempoolTransactions(address string) (v []string, err
}
func (c *fakeBlockChain) GetMempoolTransactionsForAddrDesc(addrDesc bchain.AddressDescriptor) (v []string, err error) {
return nil, errors.New("Not implemented")
return []string{}, nil
}
func (c *fakeBlockChain) GetMempoolEntry(txid string) (v *bchain.MempoolEntry, err error) {