From e52719c3f71761a3c937326456a41ae5f97d9b81 Mon Sep 17 00:00:00 2001 From: Aaron Lindsay Date: Sat, 9 Dec 2017 19:55:34 -0500 Subject: [PATCH] Split integration tests into their own package --- .travis.yml | 2 +- .../{handlers => integration}/accounts_lua_test.go | 2 +- internal/{handlers => integration}/accounts_test.go | 2 +- .../{handlers => integration}/balance_lua_test.go | 2 +- internal/{handlers => integration}/common_test.go | 2 +- internal/{handlers => integration}/date_lua_test.go | 2 +- internal/{handlers => integration}/gnucash_test.go | 4 ++-- internal/{handlers => integration}/ofx_test.go | 12 ++++++------ .../{handlers => integration}/prices_lua_test.go | 2 +- internal/{handlers => integration}/prices_test.go | 2 +- .../{handlers => integration}/reports_lua_test.go | 2 +- internal/{handlers => integration}/reports_test.go | 2 +- .../securities_lua_test.go | 2 +- .../{handlers => integration}/securities_test.go | 2 +- .../security_templates_test.go | 2 +- internal/{handlers => integration}/sessions_test.go | 2 +- .../testdata}/401k_mutualfunds.ofx | 0 .../testdata}/brokerage.ofx | 0 .../testdata}/checking_20171126.ofx | 0 .../testdata}/checking_20171129.ofx | 0 .../testdata}/creditcard.ofx | 0 .../testdata}/example.gnucash | Bin internal/{handlers => integration}/testdata_test.go | 2 +- .../{handlers => integration}/transactions_test.go | 2 +- internal/{handlers => integration}/users_test.go | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) rename internal/{handlers => integration}/accounts_lua_test.go (99%) rename internal/{handlers => integration}/accounts_test.go (99%) rename internal/{handlers => integration}/balance_lua_test.go (99%) rename internal/{handlers => integration}/common_test.go (99%) rename internal/{handlers => integration}/date_lua_test.go (98%) rename internal/{handlers => integration}/gnucash_test.go (97%) rename internal/{handlers => integration}/ofx_test.go (93%) rename internal/{handlers => integration}/prices_lua_test.go (98%) rename internal/{handlers => integration}/prices_test.go (99%) rename internal/{handlers => integration}/reports_lua_test.go (97%) rename internal/{handlers => integration}/reports_test.go (99%) rename internal/{handlers => integration}/securities_lua_test.go (99%) rename internal/{handlers => integration}/securities_test.go (99%) rename internal/{handlers => integration}/security_templates_test.go (99%) rename internal/{handlers => integration}/sessions_test.go (99%) rename internal/{handlers/handlers_testdata => integration/testdata}/401k_mutualfunds.ofx (100%) rename internal/{handlers/handlers_testdata => integration/testdata}/brokerage.ofx (100%) rename internal/{handlers/handlers_testdata => integration/testdata}/checking_20171126.ofx (100%) rename internal/{handlers/handlers_testdata => integration/testdata}/checking_20171129.ofx (100%) rename internal/{handlers/handlers_testdata => integration/testdata}/creditcard.ofx (100%) rename internal/{handlers/handlers_testdata => integration/testdata}/example.gnucash (100%) rename internal/{handlers => integration}/testdata_test.go (99%) rename internal/{handlers => integration}/transactions_test.go (99%) rename internal/{handlers => integration}/users_test.go (99%) diff --git a/.travis.yml b/.travis.yml index 2d6753b..cc9eb8a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -59,7 +59,7 @@ script: - touch $GOPATH/src/github.com/aclindsa/moneygo/internal/handlers/cusip_list.csv # Build and test MoneyGo - go generate -v github.com/aclindsa/moneygo/internal/handlers - - go test -v -covermode=count -coverpkg github.com/aclindsa/moneygo/internal/config,github.com/aclindsa/moneygo/internal/handlers,github.com/aclindsa/moneygo/internal/models,github.com/aclindsa/moneygo/internal/store,github.com/aclindsa/moneygo/internal/store/db -coverprofile=coverage.out github.com/aclindsa/moneygo/internal/handlers + - go test -v -covermode=count -coverpkg github.com/aclindsa/moneygo/internal/config,github.com/aclindsa/moneygo/internal/handlers,github.com/aclindsa/moneygo/internal/models,github.com/aclindsa/moneygo/internal/store,github.com/aclindsa/moneygo/internal/store/db -coverprofile=coverage.out github.com/aclindsa/moneygo/internal/integration # Report the test coverage after_script: diff --git a/internal/handlers/accounts_lua_test.go b/internal/integration/accounts_lua_test.go similarity index 99% rename from internal/handlers/accounts_lua_test.go rename to internal/integration/accounts_lua_test.go index f9abdce..1951dda 100644 --- a/internal/handlers/accounts_lua_test.go +++ b/internal/integration/accounts_lua_test.go @@ -1,4 +1,4 @@ -package handlers_test +package integration_test import ( "fmt" diff --git a/internal/handlers/accounts_test.go b/internal/integration/accounts_test.go similarity index 99% rename from internal/handlers/accounts_test.go rename to internal/integration/accounts_test.go index d0b92a4..972cf0c 100644 --- a/internal/handlers/accounts_test.go +++ b/internal/integration/accounts_test.go @@ -1,4 +1,4 @@ -package handlers_test +package integration_test import ( "github.com/aclindsa/moneygo/internal/handlers" diff --git a/internal/handlers/balance_lua_test.go b/internal/integration/balance_lua_test.go similarity index 99% rename from internal/handlers/balance_lua_test.go rename to internal/integration/balance_lua_test.go index 7d5014a..4d61a18 100644 --- a/internal/handlers/balance_lua_test.go +++ b/internal/integration/balance_lua_test.go @@ -1,4 +1,4 @@ -package handlers_test +package integration_test import ( "fmt" diff --git a/internal/handlers/common_test.go b/internal/integration/common_test.go similarity index 99% rename from internal/handlers/common_test.go rename to internal/integration/common_test.go index 87fd7dc..4d33d85 100644 --- a/internal/handlers/common_test.go +++ b/internal/integration/common_test.go @@ -1,4 +1,4 @@ -package handlers_test +package integration_test import ( "bytes" diff --git a/internal/handlers/date_lua_test.go b/internal/integration/date_lua_test.go similarity index 98% rename from internal/handlers/date_lua_test.go rename to internal/integration/date_lua_test.go index d152027..598e7e1 100644 --- a/internal/handlers/date_lua_test.go +++ b/internal/integration/date_lua_test.go @@ -1,4 +1,4 @@ -package handlers_test +package integration_test import ( "testing" diff --git a/internal/handlers/gnucash_test.go b/internal/integration/gnucash_test.go similarity index 97% rename from internal/handlers/gnucash_test.go rename to internal/integration/gnucash_test.go index 3bbd2df..cd471c4 100644 --- a/internal/handlers/gnucash_test.go +++ b/internal/integration/gnucash_test.go @@ -1,4 +1,4 @@ -package handlers_test +package integration_test import ( "github.com/aclindsa/moneygo/internal/models" @@ -26,7 +26,7 @@ func TestImportGnucash(t *testing.T) { } // Import and ensure it didn't return a nasty error code - if err = importGnucash(d.clients[0], "handlers_testdata/example.gnucash"); err != nil { + if err = importGnucash(d.clients[0], "testdata/example.gnucash"); err != nil { t.Fatalf("Error importing from Gnucash: %s\n", err) } diff --git a/internal/handlers/ofx_test.go b/internal/integration/ofx_test.go similarity index 93% rename from internal/handlers/ofx_test.go rename to internal/integration/ofx_test.go index af8712f..0fc4f24 100644 --- a/internal/handlers/ofx_test.go +++ b/internal/integration/ofx_test.go @@ -1,4 +1,4 @@ -package handlers_test +package integration_test import ( "fmt" @@ -28,12 +28,12 @@ func TestImportOFXChecking(t *testing.T) { } // Import and ensure it didn't return a nasty error code - if err = importOFX(d.clients[0], d.accounts[1].AccountId, "handlers_testdata/checking_20171126.ofx"); err != nil { + if err = importOFX(d.clients[0], d.accounts[1].AccountId, "testdata/checking_20171126.ofx"); err != nil { t.Fatalf("Error importing OFX: %s\n", err) } accountBalanceHelper(t, d.clients[0], &d.accounts[1], "2493.19") - if err = importOFX(d.clients[0], d.accounts[1].AccountId, "handlers_testdata/checking_20171129.ofx"); err != nil { + if err = importOFX(d.clients[0], d.accounts[1].AccountId, "testdata/checking_20171129.ofx"); err != nil { t.Fatalf("Error importing OFX: %s\n", err) } accountBalanceHelper(t, d.clients[0], &d.accounts[1], "5336.27") @@ -56,7 +56,7 @@ func TestImportOFXCreditCard(t *testing.T) { } // Import and ensure it didn't return a nasty error code - if err = importOFX(d.clients[0], d.accounts[7].AccountId, "handlers_testdata/creditcard.ofx"); err != nil { + if err = importOFX(d.clients[0], d.accounts[7].AccountId, "testdata/creditcard.ofx"); err != nil { t.Fatalf("Error importing OFX: %s\n", err) } accountBalanceHelper(t, d.clients[0], &d.accounts[7], "-4.49") @@ -118,7 +118,7 @@ func TestImportOFX401kMutualFunds(t *testing.T) { } // Import and ensure it didn't return a nasty error code - if err = importOFX(d.clients[0], account.AccountId, "handlers_testdata/401k_mutualfunds.ofx"); err != nil { + if err = importOFX(d.clients[0], account.AccountId, "testdata/401k_mutualfunds.ofx"); err != nil { t.Fatalf("Error importing OFX: %s\n", err) } accountBalanceHelper(t, d.clients[0], account, "-192.10") @@ -177,7 +177,7 @@ func TestImportOFXBrokerage(t *testing.T) { } // Import and ensure it didn't return a nasty error code - if err = importOFX(d.clients[0], account.AccountId, "handlers_testdata/brokerage.ofx"); err != nil { + if err = importOFX(d.clients[0], account.AccountId, "testdata/brokerage.ofx"); err != nil { t.Fatalf("Error importing OFX: %s\n", err) } accountBalanceHelper(t, d.clients[0], account, "387.48") diff --git a/internal/handlers/prices_lua_test.go b/internal/integration/prices_lua_test.go similarity index 98% rename from internal/handlers/prices_lua_test.go rename to internal/integration/prices_lua_test.go index f931b86..808b757 100644 --- a/internal/handlers/prices_lua_test.go +++ b/internal/integration/prices_lua_test.go @@ -1,4 +1,4 @@ -package handlers_test +package integration_test import ( "fmt" diff --git a/internal/handlers/prices_test.go b/internal/integration/prices_test.go similarity index 99% rename from internal/handlers/prices_test.go rename to internal/integration/prices_test.go index 8c44379..cb1fc5f 100644 --- a/internal/handlers/prices_test.go +++ b/internal/integration/prices_test.go @@ -1,4 +1,4 @@ -package handlers_test +package integration_test import ( "github.com/aclindsa/moneygo/internal/handlers" diff --git a/internal/handlers/reports_lua_test.go b/internal/integration/reports_lua_test.go similarity index 97% rename from internal/handlers/reports_lua_test.go rename to internal/integration/reports_lua_test.go index bf67f5b..4b0f5f9 100644 --- a/internal/handlers/reports_lua_test.go +++ b/internal/integration/reports_lua_test.go @@ -1,4 +1,4 @@ -package handlers_test +package integration_test import ( "fmt" diff --git a/internal/handlers/reports_test.go b/internal/integration/reports_test.go similarity index 99% rename from internal/handlers/reports_test.go rename to internal/integration/reports_test.go index 6f97b8c..f44e448 100644 --- a/internal/handlers/reports_test.go +++ b/internal/integration/reports_test.go @@ -1,4 +1,4 @@ -package handlers_test +package integration_test import ( "github.com/aclindsa/moneygo/internal/handlers" diff --git a/internal/handlers/securities_lua_test.go b/internal/integration/securities_lua_test.go similarity index 99% rename from internal/handlers/securities_lua_test.go rename to internal/integration/securities_lua_test.go index 2f84ce2..28bce3b 100644 --- a/internal/handlers/securities_lua_test.go +++ b/internal/integration/securities_lua_test.go @@ -1,4 +1,4 @@ -package handlers_test +package integration_test import ( "fmt" diff --git a/internal/handlers/securities_test.go b/internal/integration/securities_test.go similarity index 99% rename from internal/handlers/securities_test.go rename to internal/integration/securities_test.go index 8d786ad..a535981 100644 --- a/internal/handlers/securities_test.go +++ b/internal/integration/securities_test.go @@ -1,4 +1,4 @@ -package handlers_test +package integration_test import ( "github.com/aclindsa/moneygo/internal/handlers" diff --git a/internal/handlers/security_templates_test.go b/internal/integration/security_templates_test.go similarity index 99% rename from internal/handlers/security_templates_test.go rename to internal/integration/security_templates_test.go index 1728576..deb58de 100644 --- a/internal/handlers/security_templates_test.go +++ b/internal/integration/security_templates_test.go @@ -1,4 +1,4 @@ -package handlers_test +package integration_test import ( "github.com/aclindsa/moneygo/internal/handlers" diff --git a/internal/handlers/sessions_test.go b/internal/integration/sessions_test.go similarity index 99% rename from internal/handlers/sessions_test.go rename to internal/integration/sessions_test.go index e065bac..5f821c9 100644 --- a/internal/handlers/sessions_test.go +++ b/internal/integration/sessions_test.go @@ -1,4 +1,4 @@ -package handlers_test +package integration_test import ( "fmt" diff --git a/internal/handlers/handlers_testdata/401k_mutualfunds.ofx b/internal/integration/testdata/401k_mutualfunds.ofx similarity index 100% rename from internal/handlers/handlers_testdata/401k_mutualfunds.ofx rename to internal/integration/testdata/401k_mutualfunds.ofx diff --git a/internal/handlers/handlers_testdata/brokerage.ofx b/internal/integration/testdata/brokerage.ofx similarity index 100% rename from internal/handlers/handlers_testdata/brokerage.ofx rename to internal/integration/testdata/brokerage.ofx diff --git a/internal/handlers/handlers_testdata/checking_20171126.ofx b/internal/integration/testdata/checking_20171126.ofx similarity index 100% rename from internal/handlers/handlers_testdata/checking_20171126.ofx rename to internal/integration/testdata/checking_20171126.ofx diff --git a/internal/handlers/handlers_testdata/checking_20171129.ofx b/internal/integration/testdata/checking_20171129.ofx similarity index 100% rename from internal/handlers/handlers_testdata/checking_20171129.ofx rename to internal/integration/testdata/checking_20171129.ofx diff --git a/internal/handlers/handlers_testdata/creditcard.ofx b/internal/integration/testdata/creditcard.ofx similarity index 100% rename from internal/handlers/handlers_testdata/creditcard.ofx rename to internal/integration/testdata/creditcard.ofx diff --git a/internal/handlers/handlers_testdata/example.gnucash b/internal/integration/testdata/example.gnucash similarity index 100% rename from internal/handlers/handlers_testdata/example.gnucash rename to internal/integration/testdata/example.gnucash diff --git a/internal/handlers/testdata_test.go b/internal/integration/testdata_test.go similarity index 99% rename from internal/handlers/testdata_test.go rename to internal/integration/testdata_test.go index 3d15888..465fa19 100644 --- a/internal/handlers/testdata_test.go +++ b/internal/integration/testdata_test.go @@ -1,4 +1,4 @@ -package handlers_test +package integration_test import ( "encoding/json" diff --git a/internal/handlers/transactions_test.go b/internal/integration/transactions_test.go similarity index 99% rename from internal/handlers/transactions_test.go rename to internal/integration/transactions_test.go index 4d2ee54..c9cf73f 100644 --- a/internal/handlers/transactions_test.go +++ b/internal/integration/transactions_test.go @@ -1,4 +1,4 @@ -package handlers_test +package integration_test import ( "fmt" diff --git a/internal/handlers/users_test.go b/internal/integration/users_test.go similarity index 99% rename from internal/handlers/users_test.go rename to internal/integration/users_test.go index a7c2acf..da1f57d 100644 --- a/internal/handlers/users_test.go +++ b/internal/integration/users_test.go @@ -1,4 +1,4 @@ -package handlers_test +package integration_test import ( "github.com/aclindsa/moneygo/internal/handlers"