diff options
Diffstat (limited to 'svc')
-rw-r--r-- | svc/cache_test.go | 2 | ||||
-rw-r--r-- | svc/db_test.go | 18 | ||||
-rw-r--r-- | svc/init_test.go | 10 | ||||
-rw-r--r-- | svc/post_test.go | 6 | ||||
-rw-r--r-- | svc/query_test.go | 14 |
5 files changed, 25 insertions, 25 deletions
diff --git a/svc/cache_test.go b/svc/cache_test.go index d54d4c3..96c2638 100644 --- a/svc/cache_test.go +++ b/svc/cache_test.go @@ -49,7 +49,7 @@ func Test_cacheUpdate(t *testing.T) { killStatuses() cacheUpdate() - urls := "https://gbmor.dev/twtxt.txt" + urls := "https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt" newStatus := twtxtCache.Users[urls].Status t.Run("Checking for any data", func(t *testing.T) { diff --git a/svc/db_test.go b/svc/db_test.go index f9ae26e..f54d610 100644 --- a/svc/db_test.go +++ b/svc/db_test.go @@ -30,17 +30,17 @@ func Test_pushpullDatabase(t *testing.T) { initTestConf() initTestDB() - out, _, err := registry.GetTwtxt("https://gbmor.dev/twtxt.txt", nil) + out, _, err := registry.GetTwtxt("https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt", nil) if err != nil { t.Errorf("Couldn't set up test: %v\n", err) } - statusmap, err := registry.ParseUserTwtxt(out, "gbmor", "https://gbmor.dev/twtxt.txt") + statusmap, err := registry.ParseUserTwtxt(out, "getwtxttest", "https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt") if err != nil { t.Errorf("Couldn't set up test: %v\n", err) } - twtxtCache.AddUser("gbmor", "https://gbmor.dev/twtxt.txt", net.ParseIP("127.0.0.1"), statusmap) + twtxtCache.AddUser("getwtxttest", "https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt", net.ParseIP("127.0.0.1"), statusmap) remoteRegistries.List = append(remoteRegistries.List, "https://twtxt.tilde.institute/api/plain/users") @@ -52,7 +52,7 @@ func Test_pushpullDatabase(t *testing.T) { }) t.Run("Clearing Registry", func(t *testing.T) { - err := twtxtCache.DelUser("https://gbmor.dev/twtxt.txt") + err := twtxtCache.DelUser("https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt") if err != nil { t.Errorf("%v", err) } @@ -62,7 +62,7 @@ func Test_pushpullDatabase(t *testing.T) { pullDB() twtxtCache.Mu.RLock() - if _, ok := twtxtCache.Users["https://gbmor.dev/twtxt.txt"]; !ok { + if _, ok := twtxtCache.Users["https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt"]; !ok { t.Errorf("Missing user previously pushed to database\n") } twtxtCache.Mu.RUnlock() @@ -73,18 +73,18 @@ func Benchmark_pushDatabase(b *testing.B) { initTestConf() initTestDB() - if _, ok := twtxtCache.Users["https://gbmor.dev/twtxt.txt"]; !ok { - out, _, err := registry.GetTwtxt("https://gbmor.dev/twtxt.txt", nil) + if _, ok := twtxtCache.Users["https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt"]; !ok { + out, _, err := registry.GetTwtxt("https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt", nil) if err != nil { b.Errorf("Couldn't set up benchmark: %v\n", err) } - statusmap, err := registry.ParseUserTwtxt(out, "gbmor", "https://gbmor.dev/twtxt.txt") + statusmap, err := registry.ParseUserTwtxt(out, "getwtxttest", "https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt") if err != nil { b.Errorf("Couldn't set up benchmark: %v\n", err) } - twtxtCache.AddUser("gbmor", "https://gbmor.dev/twtxt.txt", net.ParseIP("127.0.0.1"), statusmap) + twtxtCache.AddUser("getwtxttest", "https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt", net.ParseIP("127.0.0.1"), statusmap) } b.ResetTimer() diff --git a/svc/init_test.go b/svc/init_test.go index 9273a9b..2fbfd5e 100644 --- a/svc/init_test.go +++ b/svc/init_test.go @@ -111,21 +111,21 @@ func testConfig() { // user and their statuses, for testing. func mockRegistry() { twtxtCache = registry.New(nil) - statuses, _, _ := registry.GetTwtxt("https://gbmor.dev/twtxt.txt", nil) - parsed, _ := registry.ParseUserTwtxt(statuses, "gbmor", "https://gbmor.dev/twtxt.txt") - _ = twtxtCache.AddUser("gbmor", "https://gbmor.dev/twtxt.txt", net.ParseIP("127.0.0.1"), parsed) + statuses, _, _ := registry.GetTwtxt("https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt", nil) + parsed, _ := registry.ParseUserTwtxt(statuses, "getwtxttest", "https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt") + _ = twtxtCache.AddUser("getwtxttest", "https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt", net.ParseIP("127.0.0.1"), parsed) } // Empties the mock registry's user of statuses // for functions that test status modifications func killStatuses() { twtxtCache.Mu.Lock() - user := twtxtCache.Users["https://gbmor.dev/twtxt.txt"] + user := twtxtCache.Users["https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt"] user.Mu.Lock() user.Status = registry.NewTimeMap() user.LastModified = "0" - twtxtCache.Users["https://gbmor.dev/twtxt.txt"] = user + twtxtCache.Users["https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt"] = user user.Mu.Unlock() twtxtCache.Mu.Unlock() diff --git a/svc/post_test.go b/svc/post_test.go index f799a08..cd15565 100644 --- a/svc/post_test.go +++ b/svc/post_test.go @@ -38,8 +38,8 @@ var apiPostUserCases = []struct { }{ { name: "Known Good User", - nick: "gbmor", - uri: "https://gbmor.dev/twtxt.txt", + nick: "getwtxttest", + uri: "https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt", wantErr: false, }, { @@ -100,7 +100,7 @@ func Benchmark_apiPostUser(b *testing.B) { twtxtCache = registry.New(nil) params := url.Values{} - params.Set("url", "https://gbmor.dev/twtxt.txt") + params.Set("url", "https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt") params.Set("nickname", "gbmor") req, _ := http.NewRequest("POST", "https://localhost"+portnum+"/api/plain/users", strings.NewReader(params.Encode())) req.Header.Add("Content-Type", "application/x-www-form-urlencoded") diff --git a/svc/query_test.go b/svc/query_test.go index 78d807b..d2d7304 100644 --- a/svc/query_test.go +++ b/svc/query_test.go @@ -61,8 +61,8 @@ func Benchmark_dedupe(b *testing.B) { func Test_parseQueryOut(t *testing.T) { initTestConf() - urls := "https://gbmor.dev/twtxt.txt" - nick := "gbmor" + urls := "https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt" + nick := "getwtxttest" out, _, err := registry.GetTwtxt(urls, nil) if err != nil { @@ -95,8 +95,8 @@ func Test_parseQueryOut(t *testing.T) { func Benchmark_parseQueryOut(b *testing.B) { initTestConf() - urls := "https://gbmor.dev/twtxt.txt" - nick := "gbmor" + urls := "https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt" + nick := "getwtxttest" out, _, err := registry.GetTwtxt(urls, nil) if err != nil { @@ -203,9 +203,9 @@ func Test_compositeStatusQuery(t *testing.T) { func Benchmark_compositeStatusQuery(b *testing.B) { initTestConf() - statuses, _, _ := registry.GetTwtxt("https://gbmor.dev/twtxt.txt", nil) - parsed, _ := registry.ParseUserTwtxt(statuses, "gbmor", "https://gbmor.dev/twtxt.txt") - _ = twtxtCache.AddUser("gbmor", "https://gbmor.dev/twtxt.txt", net.ParseIP("127.0.0.1"), parsed) + statuses, _, _ := registry.GetTwtxt("https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt", nil) + parsed, _ := registry.ParseUserTwtxt(statuses, "getwtxttest", "https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt") + _ = twtxtCache.AddUser("getwtxttest", "https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt", net.ParseIP("127.0.0.1"), parsed) b.ResetTimer() for i := 0; i < b.N; i++ { |