about summary refs log tree commit diff stats
path: root/svc/db_test.go
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2020-06-20 02:27:31 -0400
committerBen Morrison <ben@gbmor.dev>2020-06-20 02:27:31 -0400
commit538e305925b9b04102ef0a4fb7cca19a6c116142 (patch)
tree8e68b426c40c3151f39da1be874d2938f31ab5f9 /svc/db_test.go
parent0a69c582ec8b88b1d3af70ef43c3eeb1b99f973d (diff)
downloadgetwtxt-538e305925b9b04102ef0a4fb7cca19a6c116142.tar.gz
updating module to live at sourcehut
Also moving the 'registry' library into this repo, rather
than maintaining them separately. It will still be decoupled,
just live in this repository.
Diffstat (limited to 'svc/db_test.go')
-rw-r--r--svc/db_test.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/svc/db_test.go b/svc/db_test.go
index f54d610..21fc972 100644
--- a/svc/db_test.go
+++ b/svc/db_test.go
@@ -17,30 +17,30 @@ You should have received a copy of the GNU General Public License
 along with Getwtxt.  If not, see <https://www.gnu.org/licenses/>.
 */
 
-package svc // import "github.com/getwtxt/getwtxt/svc"
+package svc // import "git.sr.ht/~gbmor/getwtxt/svc"
 
 import (
 	"net"
 	"testing"
 
-	"github.com/getwtxt/registry"
+	"git.sr.ht/~gbmor/getwtxt/registry"
 )
 
 func Test_pushpullDatabase(t *testing.T) {
 	initTestConf()
 	initTestDB()
 
-	out, _, err := registry.GetTwtxt("https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt", nil)
+	out, _, err := registry.GetTwtxt(testTwtxtURL, nil)
 	if err != nil {
 		t.Errorf("Couldn't set up test: %v\n", err)
 	}
 
-	statusmap, err := registry.ParseUserTwtxt(out, "getwtxttest", "https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt")
+	statusmap, err := registry.ParseUserTwtxt(out, "getwtxttest", testTwtxtURL)
 	if err != nil {
 		t.Errorf("Couldn't set up test: %v\n", err)
 	}
 
-	twtxtCache.AddUser("getwtxttest", "https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt", net.ParseIP("127.0.0.1"), statusmap)
+	twtxtCache.AddUser("getwtxttest", testTwtxtURL, 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://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt")
+		err := twtxtCache.DelUser(testTwtxtURL)
 		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://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt"]; !ok {
+		if _, ok := twtxtCache.Users[testTwtxtURL]; !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://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 _, ok := twtxtCache.Users[testTwtxtURL]; !ok {
+		out, _, err := registry.GetTwtxt(testTwtxtURL, nil)
 		if err != nil {
 			b.Errorf("Couldn't set up benchmark: %v\n", err)
 		}
 
-		statusmap, err := registry.ParseUserTwtxt(out, "getwtxttest", "https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt")
+		statusmap, err := registry.ParseUserTwtxt(out, "getwtxttest", testTwtxtURL)
 		if err != nil {
 			b.Errorf("Couldn't set up benchmark: %v\n", err)
 		}
 
-		twtxtCache.AddUser("getwtxttest", "https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt", net.ParseIP("127.0.0.1"), statusmap)
+		twtxtCache.AddUser("getwtxttest", testTwtxtURL, net.ParseIP("127.0.0.1"), statusmap)
 	}
 
 	b.ResetTimer()