mirror of
https://github.com/gravitl/netmaker.git
synced 2025-02-25 00:24:37 +08:00
SecurityCheck tests
This commit is contained in:
parent
74f6b5639d
commit
ce0cd9cd54
1 changed files with 18 additions and 0 deletions
|
@ -217,6 +217,24 @@ func TestDeleteKey(t *testing.T) {
|
|||
})
|
||||
}
|
||||
func TestSecurityCheck(t *testing.T) {
|
||||
t.Run("NoNetwork", func(t *testing.T) {
|
||||
err := SecurityCheck("", "Bearer secretkey")
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
t.Run("WithNetwork", func(t *testing.T) {
|
||||
err := SecurityCheck("skynet", "Bearer secretkey")
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
t.Run("BadNet", func(t *testing.T) {
|
||||
err := SecurityCheck("badnet", "Bearer secretkey")
|
||||
assert.NotNil(t, err)
|
||||
t.Log(err)
|
||||
})
|
||||
t.Run("BadToken", func(t *testing.T) {
|
||||
err := SecurityCheck("skynet", "Bearer badkey")
|
||||
assert.NotNil(t, err)
|
||||
t.Log(err)
|
||||
})
|
||||
}
|
||||
func TestValidateNetworkUpdate(t *testing.T) {
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue