Skip to content
This repository was archived by the owner on Jan 17, 2023. It is now read-only.

Commit e36bf9a

Browse files
author
Alex Collins
committed
Issue #87 add tests for masking passwords in toString()
1 parent 71ac5fa commit e36bf9a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/unit/docker/registry/web/RegistrySpec.groovy

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,13 @@ class RegistrySpec extends Specification {
149149
"username".equals(registry.username)
150150
registry.password == null
151151
}
152+
153+
void "test toString doesn't contain password :)"() {
154+
when:
155+
def registryStr = Registry.fromUrl("http://admin:abc123@172.17.42.1:5000/v1/").toString()
156+
then:
157+
registryStr != null
158+
!registryStr.contains("abc123")
159+
registryStr.contains("******") // * replaces abc123
160+
}
152161
}

0 commit comments

Comments
 (0)