Skip to content

Commit 3b8a674

Browse files
Merge branch 'master' into fix/RTECO-694-JFrog-CLI-command-jf-rbs-versions-not-showing-results-with-project
2 parents 566a1e9 + 735468f commit 3b8a674

File tree

3 files changed

+70
-6
lines changed

3 files changed

+70
-6
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ require (
1616
github.com/docker/docker v28.5.2+incompatible
1717
github.com/gocarina/gocsv v0.0.0-20240520201108-78e41c74b4b1
1818
github.com/jfrog/archiver/v3 v3.6.1
19-
github.com/jfrog/build-info-go v1.13.0
19+
github.com/jfrog/build-info-go v1.13.1-0.20251230063402-e9f0a3564df1
2020
github.com/jfrog/gofrog v1.7.6
2121
github.com/jfrog/jfrog-cli-application v1.0.2-0.20251210075951-519050602a7f
22-
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20251230062658-a3f96d1fd36a
22+
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20251230064405-049e011b0bb7
2323
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20251223102649-e659f6937251
2424
github.com/jfrog/jfrog-cli-evidence v0.8.3-0.20251204144808-73fa744851c0
2525
github.com/jfrog/jfrog-cli-platform-services v1.10.1-0.20251205121610-171eb9b0000e

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,8 +1204,8 @@ github.com/jellydator/ttlcache/v3 v3.4.0 h1:YS4P125qQS0tNhtL6aeYkheEaB/m8HCqdMMP
12041204
github.com/jellydator/ttlcache/v3 v3.4.0/go.mod h1:Hw9EgjymziQD3yGsQdf1FqFdpp7YjFMd4Srg5EJlgD4=
12051205
github.com/jfrog/archiver/v3 v3.6.1 h1:LOxnkw9pOn45DzCbZNFV6K0+6dCsQ0L8mR3ZcujO5eI=
12061206
github.com/jfrog/archiver/v3 v3.6.1/go.mod h1:VgR+3WZS4N+i9FaDwLZbq+jeU4B4zctXL+gL4EMzfLw=
1207-
github.com/jfrog/build-info-go v1.13.0 h1:bHedp1Gl+a8eR71xxP5JvkqwDj2X3r6e5NiIwNcIwRM=
1208-
github.com/jfrog/build-info-go v1.13.0/go.mod h1:+OCtMb22/D+u7Wne5lzkjJjaWr0LRZcHlDwTH86Mpwo=
1207+
github.com/jfrog/build-info-go v1.13.1-0.20251230063402-e9f0a3564df1 h1:ZT/hph6QcpTi9Fam9MJiouJ6g0H8Hx9p2Mnah2zPnks=
1208+
github.com/jfrog/build-info-go v1.13.1-0.20251230063402-e9f0a3564df1/go.mod h1:+OCtMb22/D+u7Wne5lzkjJjaWr0LRZcHlDwTH86Mpwo=
12091209
github.com/jfrog/froggit-go v1.20.6 h1:Xp7+LlEh0m1KGrQstb+u0aGfjRUtv1eh9xQBV3571jQ=
12101210
github.com/jfrog/froggit-go v1.20.6/go.mod h1:obSG1SlsWjktkuqmKtpq7MNTTL63e0ot+ucTnlOMV88=
12111211
github.com/jfrog/go-mockhttp v0.3.1 h1:/wac8v4GMZx62viZmv4wazB5GNKs+GxawuS1u3maJH8=
@@ -1216,8 +1216,8 @@ github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYL
12161216
github.com/jfrog/jfrog-apps-config v1.0.1/go.mod h1:8AIIr1oY9JuH5dylz2S6f8Ym2MaadPLR6noCBO4C22w=
12171217
github.com/jfrog/jfrog-cli-application v1.0.2-0.20251210075951-519050602a7f h1:YHwPNF13Gmt65J618kEGn/4SGewXqyYuAdcyYWYdrBA=
12181218
github.com/jfrog/jfrog-cli-application v1.0.2-0.20251210075951-519050602a7f/go.mod h1:xum2HquWO5uExa/A7MQs3TgJJVEeoqTR+6Z4mfBr1Xw=
1219-
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20251230062658-a3f96d1fd36a h1:V2L7J9Kum4ur4EbvubES/Ej54LoI6iN/HuDJm684EGY=
1220-
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20251230062658-a3f96d1fd36a/go.mod h1:zLyP0cwq+Ahn+d3CmjV3FvT1htoD/I4d6gFvKBLwrTI=
1219+
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20251230064405-049e011b0bb7 h1:UzFwA39ZTvinCbNvhr9QooeZaF1NBMkxXdBYJwTrXcU=
1220+
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20251230064405-049e011b0bb7/go.mod h1:T8BzK7jnojx74G/tFs6lTjvNjNO6ltdWaZmY0X0YOOI=
12211221
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20251223102649-e659f6937251 h1:WTyDOaYJUwY6zQujZuL9JQ9Q9+QWj9p31tLb4bJnu4U=
12221222
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20251223102649-e659f6937251/go.mod h1:REkU0OfnLYZbQIjD2Cg85DAVP0SRZuV/PxiDfCJiJOc=
12231223
github.com/jfrog/jfrog-cli-evidence v0.8.3-0.20251204144808-73fa744851c0 h1:8S1vE1PeVtrzWkKL0N39cX6XLLNV0It+f6xjRKjw7Ug=

pip_test.go

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"strings"
1212
"testing"
1313

14+
pythoncmd "github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/python"
1415
"github.com/jfrog/jfrog-cli-core/v2/artifactory/utils"
1516

1617
biutils "github.com/jfrog/build-info-go/utils"
@@ -595,6 +596,69 @@ func validateBuildTimestampProperty(properties map[string][]string, moduleType b
595596
return nil
596597
}
597598

599+
func TestCreateAqlQueryForSearchBySHA256(t *testing.T) {
600+
tests := []struct {
601+
name string
602+
repo string
603+
sha256s []string
604+
expected string
605+
}{
606+
{
607+
name: "single SHA256",
608+
repo: "pypi-local",
609+
sha256s: []string{"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"},
610+
expected: `{"repo": "pypi-local","$or": [{"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}]}`,
611+
},
612+
{
613+
name: "multiple SHA256s",
614+
repo: "pypi-local",
615+
sha256s: []string{
616+
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
617+
"a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456",
618+
"f6e5d4c3b2a1098765432109876543210987654321098765432109876543210987",
619+
},
620+
expected: `{"repo": "pypi-local","$or": [{"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"},{"sha256": "a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456"},{"sha256": "f6e5d4c3b2a1098765432109876543210987654321098765432109876543210987"}]}`,
621+
},
622+
{
623+
name: "empty SHA256s",
624+
repo: "pypi-local",
625+
sha256s: []string{},
626+
expected: `{"repo": "pypi-local","$or": []}`,
627+
},
628+
{
629+
name: "different repository",
630+
repo: "maven-local",
631+
sha256s: []string{"abc123def456"},
632+
expected: `{"repo": "maven-local","$or": [{"sha256": "abc123def456"}]}`,
633+
},
634+
}
635+
636+
for _, tt := range tests {
637+
t.Run(tt.name, func(t *testing.T) {
638+
result := pythoncmd.CreateAqlQueryForSearchBySHA256(tt.repo, tt.sha256s)
639+
assert.Equal(t, tt.expected, result)
640+
641+
// Verify it's valid JSON
642+
var jsonObj map[string]interface{}
643+
err := json.Unmarshal([]byte(result), &jsonObj)
644+
assert.NoError(t, err, "Generated query should be valid JSON")
645+
assert.Equal(t, tt.repo, jsonObj["repo"], "Repository should match")
646+
647+
// Verify $or array exists and has correct structure
648+
orArray, ok := jsonObj["$or"].([]interface{})
649+
assert.True(t, ok, "$or should be an array")
650+
assert.Equal(t, len(tt.sha256s), len(orArray), "Number of SHA256 conditions should match")
651+
652+
// Verify each SHA256 condition
653+
for i, sha256 := range tt.sha256s {
654+
condition, ok := orArray[i].(map[string]interface{})
655+
assert.True(t, ok, "Each condition should be an object")
656+
assert.Equal(t, sha256, condition["sha256"], "SHA256 value should match")
657+
}
658+
})
659+
}
660+
}
661+
598662
func TestSetupPipCommand(t *testing.T) {
599663
if !*tests.TestPip {
600664
t.Skip("Skipping Pip test. To run Pip test add the '-test.pip=true' option.")

0 commit comments

Comments
 (0)