We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stakwork Run
File: /tmp/stakwork/sphinx-tribes/handlers/people.go
package handlers import ( "os" "strings" "testing" "github.com/stretchr/testify/assert" ) func TestPersonIsAdmin(t *testing.T) { tests := []struct { name string adminPubkeys string pk string expected bool }{ { name: "Single Admin Key Match", adminPubkeys: "admin1", pk: "admin1", expected: true, }, { name: "Multiple Admin Keys Match", adminPubkeys: "admin1,admin2,admin3", pk: "admin2", expected: true, }, { name: "No Match with Single Admin Key", adminPubkeys: "admin1", pk: "admin2", expected: false, }, { name: "No Match with Multiple Admin Keys", adminPubkeys: "admin1,admin2,admin3", pk: "admin4", expected: false, }, { name: "Empty Admin Keys", adminPubkeys: "", pk: "admin1", expected: false, }, { name: "Empty Input Key", adminPubkeys: "admin1,admin2", pk: "", expected: false, }, { name: "Whitespace in Admin Keys", adminPubkeys: " admin1 , admin2 ", pk: "admin1", expected: true, }, { name: "Whitespace in Input Key", adminPubkeys: "admin1,admin2", pk: " admin1 ", expected: false, }, { name: "Null Input Key", adminPubkeys: "admin1,admin2", pk: "", expected: false, }, { name: "Non-String Input Key", adminPubkeys: "admin1,admin2", pk: "123", expected: false, }, { name: "Large Number of Admin Keys", adminPubkeys: strings.Repeat("admin,", 9999) + "admin9999", pk: "admin9999", expected: true, }, { name: "Long Admin Key", adminPubkeys: strings.Repeat("a", 1000), pk: strings.Repeat("a", 1000), expected: true, }, { name: "Case Sensitivity", adminPubkeys: "Admin1", pk: "admin1", expected: false, }, { name: "Special Characters in Admin Keys", adminPubkeys: "admin@1,admin#2", pk: "admin@1", expected: true, }, { name: "Comma at the End of Admin Keys", adminPubkeys: "admin1,admin2,", pk: "admin2", expected: true, }, { name: "Duplicate Admin Keys", adminPubkeys: "admin1,admin1,admin2", pk: "admin1", expected: true, }, { name: "Empty String in Admin Keys", adminPubkeys: "admin1,,admin2", pk: "", expected: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { os.Setenv("ADMIN_PUBKEYS", tt.adminPubkeys) result := PersonIsAdmin(tt.pk) assert.Equal(t, tt.expected, result) }) } }
The text was updated successfully, but these errors were encountered:
@tomsmith8 could you assign me?
Sorry, something went wrong.
@tomsmith8 Please assign me?
@tomsmith8 please assign
Shoaibdev7
Successfully merging a pull request may close this issue.
Unit Test Coverage for "PersonIsAdmin"
Stakwork Run
Unit Test Code
File: /tmp/stakwork/sphinx-tribes/handlers/people.go
The text was updated successfully, but these errors were encountered: