diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2021-06-07 07:27:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-07 07:27:09 +0200 |
commit | 3607f79d7869046d919fed05a21b55b6e61df1fa (patch) | |
tree | 9a176a4d5b67ac3a81ae210e9164d81959221ce0 /modules/lfs | |
parent | 51775f65bc933843199320b040186703a2bb9f51 (diff) | |
download | gitea-3607f79d7869046d919fed05a21b55b6e61df1fa.tar.gz gitea-3607f79d7869046d919fed05a21b55b6e61df1fa.zip |
Fixed assert statements. (#16089)
Diffstat (limited to 'modules/lfs')
-rw-r--r-- | modules/lfs/http_client_test.go | 2 | ||||
-rw-r--r-- | modules/lfs/pointer_test.go | 22 |
2 files changed, 12 insertions, 12 deletions
diff --git a/modules/lfs/http_client_test.go b/modules/lfs/http_client_test.go index 043aa0214e..68ec947aa8 100644 --- a/modules/lfs/http_client_test.go +++ b/modules/lfs/http_client_test.go @@ -56,7 +56,7 @@ func TestHTTPClientDownload(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "download", batchRequest.Operation) - assert.Equal(t, 1, len(batchRequest.Objects)) + assert.Len(t, batchRequest.Objects, 1) assert.Equal(t, oid, batchRequest.Objects[0].Oid) assert.Equal(t, size, batchRequest.Objects[0].Size) diff --git a/modules/lfs/pointer_test.go b/modules/lfs/pointer_test.go index 0ed6df2c6d..9cd8b15c9e 100644 --- a/modules/lfs/pointer_test.go +++ b/modules/lfs/pointer_test.go @@ -15,16 +15,16 @@ import ( func TestStringContent(t *testing.T) { p := Pointer{Oid: "4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393", Size: 1234} expected := "version https://git-lfs.github.com/spec/v1\noid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393\nsize 1234\n" - assert.Equal(t, p.StringContent(), expected) + assert.Equal(t, expected, p.StringContent()) } func TestRelativePath(t *testing.T) { p := Pointer{Oid: "4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393"} expected := path.Join("4d", "7a", "214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393") - assert.Equal(t, p.RelativePath(), expected) + assert.Equal(t, expected, p.RelativePath()) p2 := Pointer{Oid: "4d7a"} - assert.Equal(t, p2.RelativePath(), "4d7a") + assert.Equal(t, "4d7a", p2.RelativePath()) } func TestIsValid(t *testing.T) { @@ -48,8 +48,8 @@ func TestGeneratePointer(t *testing.T) { p, err := GeneratePointer(strings.NewReader("Gitea")) assert.NoError(t, err) assert.True(t, p.IsValid()) - assert.Equal(t, p.Oid, "94cb57646c54a297c9807697e80a30946f79a4b82cb079d2606847825b1812cc") - assert.Equal(t, p.Size, int64(5)) + assert.Equal(t, "94cb57646c54a297c9807697e80a30946f79a4b82cb079d2606847825b1812cc", p.Oid) + assert.Equal(t, int64(5), p.Size) } func TestReadPointerFromBuffer(t *testing.T) { @@ -84,20 +84,20 @@ func TestReadPointerFromBuffer(t *testing.T) { p, err = ReadPointerFromBuffer([]byte("version https://git-lfs.github.com/spec/v1\noid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393\nsize 1234\n")) assert.NoError(t, err) assert.True(t, p.IsValid()) - assert.Equal(t, p.Oid, "4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393") - assert.Equal(t, p.Size, int64(1234)) + assert.Equal(t, "4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393", p.Oid) + assert.Equal(t, int64(1234), p.Size) p, err = ReadPointerFromBuffer([]byte("version https://git-lfs.github.com/spec/v1\noid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393\nsize 1234\ntest")) assert.NoError(t, err) assert.True(t, p.IsValid()) - assert.Equal(t, p.Oid, "4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393") - assert.Equal(t, p.Size, int64(1234)) + assert.Equal(t, "4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393", p.Oid) + assert.Equal(t, int64(1234), p.Size) } func TestReadPointer(t *testing.T) { p, err := ReadPointer(strings.NewReader("version https://git-lfs.github.com/spec/v1\noid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393\nsize 1234\n")) assert.NoError(t, err) assert.True(t, p.IsValid()) - assert.Equal(t, p.Oid, "4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393") - assert.Equal(t, p.Size, int64(1234)) + assert.Equal(t, "4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393", p.Oid) + assert.Equal(t, int64(1234), p.Size) } |