diff options
author | Slack Coder <slackcoder@server.ky> | 2024-04-08 15:29:11 -0500 |
---|---|---|
committer | Slack Coder <slackcoder@server.ky> | 2024-07-18 11:47:49 -0500 |
commit | ae748859be8d6d3ed3c0929770f0c287ab6d6460 (patch) | |
tree | 284d3bf3d7fa496a9d334391eac996affc5a01b9 /internal/github/github_test.go | |
parent | c2267767ca8ed06018d26a45b483c44b7c4234cf (diff) | |
download | mirror-ae748859be8d6d3ed3c0929770f0c287ab6d6460.tar.xz |
Port to Golang
Diffstat (limited to 'internal/github/github_test.go')
-rw-r--r-- | internal/github/github_test.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/internal/github/github_test.go b/internal/github/github_test.go new file mode 100644 index 0000000..5f3a270 --- /dev/null +++ b/internal/github/github_test.go @@ -0,0 +1,34 @@ +package github + +import ( + "os" + "path" + "testing" + + "git.server.ky/slackcoder/mirror/internal" + "github.com/stretchr/testify/require" +) + +func TestMirrorDendrite(t *testing.T) { + d := t.TempDir() + + dst := internal.MustURL(d) + src := internal.MustURL("https://github.com/matrix-org/dendrite") + oldFile := "random_file.txt" + + f, cErr := os.Create(path.Join(dst.Path, oldFile)) + require.NoError(t, cErr) + f.Close() + + c := NewClient() + err := c.MirrorAssets(dst, src) + require.NoError(t, err, "dendrite assets") + + require.FileExists(t, path.Join(dst.Path, "v0.13.7", "dendrite-0.13.7.tar.gz")) + require.FileExists(t, path.Join(dst.Path, "v0.13.7", "dendrite-0.13.7.zip")) + + err = c.MirrorAssets(dst, src) + require.NoError(t, err, "dendrite assets") + + require.NoFileExists(t, path.Join(dst.Path, oldFile), "only files from mirror should exist") +} |