diff options
author | Ben Morrison <ben@gbmor.dev> | 2020-06-20 02:27:31 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2020-06-20 02:27:31 -0400 |
commit | 538e305925b9b04102ef0a4fb7cca19a6c116142 (patch) | |
tree | 8e68b426c40c3151f39da1be874d2938f31ab5f9 /svc/init_test.go | |
parent | 0a69c582ec8b88b1d3af70ef43c3eeb1b99f973d (diff) | |
download | getwtxt-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/init_test.go')
-rw-r--r-- | svc/init_test.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/svc/init_test.go b/svc/init_test.go index 2fbfd5e..0c255c5 100644 --- a/svc/init_test.go +++ b/svc/init_test.go @@ -17,7 +17,7 @@ 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 ( "bytes" @@ -29,10 +29,12 @@ import ( "sync" "testing" - "github.com/getwtxt/registry" + "git.sr.ht/~gbmor/getwtxt/registry" "github.com/spf13/viper" ) +const testTwtxtURL = "https://git.sr.ht/~gbmor/getwtxt/blob/master/testdata/twtxt.txt" + var ( testport string initTestOnce sync.Once @@ -111,21 +113,21 @@ func testConfig() { // user and their statuses, for testing. func mockRegistry() { twtxtCache = registry.New(nil) - 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) + statuses, _, _ := registry.GetTwtxt(testTwtxtURL, nil) + parsed, _ := registry.ParseUserTwtxt(statuses, "getwtxttest", testTwtxtURL) + _ = twtxtCache.AddUser("getwtxttest", testTwtxtURL, 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://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt"] + user := twtxtCache.Users[testTwtxtURL] user.Mu.Lock() user.Status = registry.NewTimeMap() user.LastModified = "0" - twtxtCache.Users["https://github.com/getwtxt/getwtxt/raw/master/testdata/twtxt.txt"] = user + twtxtCache.Users[testTwtxtURL] = user user.Mu.Unlock() twtxtCache.Mu.Unlock() |