diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-12-19 16:46:34 -0500 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-12-19 16:46:34 -0500 |
commit | 7db28dd705dd5463b5e2e9cf6f5fc87db25533ad (patch) | |
tree | fc6cf394405a36f36d0b50051b738f25a8605c54 /svc/init_test.go | |
parent | f60789a3bd40b61fb026af2f660bea3b2cc2ce46 (diff) | |
download | getwtxt-7db28dd705dd5463b5e2e9cf6f5fc87db25533ad.tar.gz |
decoupled tests from personal twtxt.txt
Rather than use my personal twtxt.txt file, I'm using the mocked twtxt.txt file I just added to the repository for test data. It is being fetched via https from github to avoid having to get rid of the url validity check in the associated registry library.
Diffstat (limited to 'svc/init_test.go')
-rw-r--r-- | svc/init_test.go | 10 |
1 files changed, 5 insertions, 5 deletions
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() |