diff options
Diffstat (limited to 'svc')
-rw-r--r-- | svc/init_test.go | 9 | ||||
-rw-r--r-- | svc/query_test.go | 10 |
2 files changed, 10 insertions, 9 deletions
diff --git a/svc/init_test.go b/svc/init_test.go index a9fe624..385db0e 100644 --- a/svc/init_test.go +++ b/svc/init_test.go @@ -3,11 +3,13 @@ package svc // import "github.com/getwtxt/getwtxt/svc" import ( "fmt" "log" + "net" "os" "strings" "sync" "time" + "github.com/getwtxt/registry" "github.com/spf13/viper" ) @@ -89,3 +91,10 @@ func testConfig() { confObj.Instance.Mail = viper.GetString("Instance.Email") confObj.Instance.Desc = viper.GetString("Instance.Description") } + +func mockRegistry() { + + statuses, _, _ := registry.GetTwtxt("https://gbmor.dev/twtxt.txt") + parsed, _ := registry.ParseUserTwtxt(statuses, "gbmor", "https://gbmor.dev/twtxt.txt") + _ = twtxtCache.AddUser("gbmor", "https://gbmor.dev/twtxt.txt", "1", net.ParseIP("127.0.0.1"), parsed) +} diff --git a/svc/query_test.go b/svc/query_test.go index 3e7e5d3..9fe6496 100644 --- a/svc/query_test.go +++ b/svc/query_test.go @@ -76,15 +76,7 @@ func Benchmark_parseQueryOut(b *testing.B) { func Test_compositeStatusQuery(t *testing.T) { initTestConf() - statuses, _, err := registry.GetTwtxt("https://gbmor.dev/twtxt.txt") - if err != nil { - t.Errorf("%v\n", err) - } - parsed, err := registry.ParseUserTwtxt(statuses, "gbmor", "https://gbmor.dev/twtxt.txt") - if err != nil { - t.Errorf("%v\n", err) - } - _ = twtxtCache.AddUser("gbmor", "https://gbmor.dev/twtxt.txt", "1", net.ParseIP("127.0.0.1"), parsed) + mockRegistry() t.Run("Composite Query Test", func(t *testing.T) { out1, err := twtxtCache.QueryInStatus("sqlite") |