Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Commit

Permalink
Fix jsonapi test
Browse files Browse the repository at this point in the history
  • Loading branch information
cpacia committed Sep 9, 2017
1 parent 9ea5c96 commit afa185e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion api/jsonapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ func (i *jsonAPIHandler) POSTSettings(w http.ResponseWriter, r *http.Request) {
return
}
settings.Version = &i.node.UserAgent
ser, err := json.MarshalIndent(settings, "", " ")
ser, err := json.MarshalIndent(settings, "", " ")
if err != nil {
ErrorResponse(w, http.StatusInternalServerError, err.Error())
return
Expand Down
2 changes: 1 addition & 1 deletion api/jsonapi_data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func NotFoundJSON(resource string) string {
//

const settingsJSON = `{
"version": "",
"version": "",
"paymentDataInQR": true,
"showNotifications": true,
"showNsfw": true,
Expand Down
4 changes: 2 additions & 2 deletions api/jsonapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestMain(m *testing.M) {
func TestSettings(t *testing.T) {
// Create, Read, Update, Patch
runAPITests(t, apiTests{
{"POST", "/ob/settings", settingsJSON, 200, "{}"},
{"POST", "/ob/settings", settingsJSON, 200, settingsJSON},
{"GET", "/ob/settings", "", 200, settingsJSON},
{"POST", "/ob/settings", settingsJSON, 409, settingsAlreadyExistsJSON},
{"PUT", "/ob/settings", settingsUpdateJSON, 200, "{}"},
Expand All @@ -53,7 +53,7 @@ func TestSettings(t *testing.T) {

// Invalid JSON
runAPITests(t, apiTests{
{"POST", "/ob/settings", settingsJSON, 200, "{}"},
{"POST", "/ob/settings", settingsJSON, 200, settingsJSON},
{"GET", "/ob/settings", "", 200, settingsJSON},
{"PUT", "/ob/settings", settingsMalformedJSON, 400, settingsMalformedJSONResponse},
})
Expand Down
4 changes: 2 additions & 2 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ func (n *OpenBazaarNode) SeedNode() error {
var rootHash string
// There's an IPFS bug on Windows that might be related to the Windows indexer that could cause this to fail
// If we fail the first time, let's retry a couple times before giving up.
for i:=0; i<3; i++ {
for i := 0; i < 3; i++ {
rootHash, aerr = ipfs.AddDirectory(n.Context, path.Join(n.RepoPath, "root"))
if aerr == nil {
break
}
time.Sleep(time.Millisecond*500)
time.Sleep(time.Millisecond * 500)
}
if aerr != nil {
return aerr
Expand Down
18 changes: 9 additions & 9 deletions openbazaard.go
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ func (x *Start) Execute(args []string) error {
bitcoinFile := logging.NewLogBackend(w3, "", 0)
bitcoinFileFormatter := logging.NewBackendFormatter(bitcoinFile, fileLogFormat)
ml := logging.MultiLogger(bitcoinFileFormatter)
var crytoWallet wallet.Wallet
var cryptoWallet wallet.Wallet
switch strings.ToLower(walletCfg.Type) {
case "spvwallet":
var tp net.Addr
Expand Down Expand Up @@ -775,7 +775,7 @@ func (x *Start) Execute(args []string) error {
Proxy: torDialer,
Logger: ml,
}
crytoWallet, err = spvwallet.NewSPVWallet(spvwalletConfig)
cryptoWallet, err = spvwallet.NewSPVWallet(spvwalletConfig)
if err != nil {
log.Error(err)
return err
Expand All @@ -788,7 +788,7 @@ func (x *Start) Execute(args []string) error {
if usingTor && !usingClearnet {
usetor = true
}
crytoWallet = bitcoind.NewBitcoindWallet(mn, &params, repoPath, walletCfg.TrustedPeer, walletCfg.Binary, walletCfg.RPCUser, walletCfg.RPCPassword, usetor, controlPort)
cryptoWallet = bitcoind.NewBitcoindWallet(mn, &params, repoPath, walletCfg.TrustedPeer, walletCfg.Binary, walletCfg.RPCUser, walletCfg.RPCPassword, usetor, controlPort)
default:
log.Fatal("Unknown wallet type")
}
Expand Down Expand Up @@ -818,7 +818,7 @@ func (x *Start) Execute(args []string) error {
return err
}
// Override config file preference if this is Mainnet, open internet and API enabled
if addr != "127.0.0.1" && crytoWallet.Params().Name == chaincfg.MainNetParams.Name && apiConfig.Enabled {
if addr != "127.0.0.1" && cryptoWallet.Params().Name == chaincfg.MainNetParams.Name && apiConfig.Enabled {
apiConfig.Authenticated = true
}
for _, ip := range x.AllowIP {
Expand Down Expand Up @@ -930,7 +930,7 @@ func (x *Start) Execute(args []string) error {
RootHash: ipath.Path(e.Value).String(),
RepoPath: repoPath,
Datastore: sqliteDB,
Wallet: crytoWallet,
Wallet: cryptoWallet,
MessageStorage: storage,
NameSystem: ns,
ExchangeRates: exchangeRates,
Expand Down Expand Up @@ -966,12 +966,12 @@ func (x *Start) Execute(args []string) error {
MR.Wait()
TL := lis.NewTransactionListener(core.Node.Datastore, core.Node.Broadcast, core.Node.Wallet)
WL := lis.NewWalletListener(core.Node.Datastore, core.Node.Broadcast)
crytoWallet.AddTransactionListener(TL.OnTransactionReceived)
crytoWallet.AddTransactionListener(WL.OnTransactionReceived)
cryptoWallet.AddTransactionListener(TL.OnTransactionReceived)
cryptoWallet.AddTransactionListener(WL.OnTransactionReceived)
log.Info("Starting bitcoin wallet")
su := bitcoin.NewStatusUpdater(crytoWallet, core.Node.Broadcast, nd.Context())
su := bitcoin.NewStatusUpdater(cryptoWallet, core.Node.Broadcast, nd.Context())
go su.Start()
go crytoWallet.Start()
go cryptoWallet.Start()
}
core.Node.UpdateFollow()
core.Node.SeedNode()
Expand Down

0 comments on commit afa185e

Please sign in to comment.