@@ -56,13 +56,13 @@ var _ = Describe("BreakRequestTemplate Webhook", func() {
5656 It ("Should deny creation" , func () {
5757 By ("simulating an invalid creation scenario" )
5858
59- response := validator .OnCreate ( nil , reader , decoder , nil )( ctx , admission. Request {} )
59+ response := test . RunWebhook ( ctx , validator .OnCreate , reader , decoder )
6060 test .VerifyResponse (response , http .StatusForbidden , "approvalCondition should not be set when autoApprove is false" )
6161 })
6262 It ("Should deny update" , func () {
6363 By ("simulating an invalid update scenario" )
6464
65- response := validator .OnUpdate ( nil , reader , decoder , nil )( ctx , admission. Request {} )
65+ response := test . RunWebhook ( ctx , validator .OnUpdate , reader , decoder )
6666 test .VerifyResponse (response , http .StatusForbidden , "approvalCondition should not be set when autoApprove is false" )
6767 })
6868 })
@@ -73,12 +73,12 @@ var _ = Describe("BreakRequestTemplate Webhook", func() {
7373 })
7474 It ("Should allow creation" , func () {
7575 By ("simulating an valid creation scenario" )
76- response := validator .OnCreate ( nil , reader , decoder , nil )( ctx , admission. Request {} )
76+ response := test . RunWebhook ( ctx , validator .OnCreate , reader , decoder )
7777 Expect (response ).To (BeNil ())
7878 })
7979 It ("Should allow update" , func () {
8080 By ("simulating an valid update scenario" )
81- response := validator .OnUpdate ( nil , reader , decoder , nil )( ctx , admission. Request {} )
81+ response := test . RunWebhook ( ctx , validator .OnUpdate , reader , decoder )
8282 Expect (response ).To (BeNil ())
8383 })
8484 })
@@ -90,12 +90,12 @@ var _ = Describe("BreakRequestTemplate Webhook", func() {
9090 })
9191 It ("Should deny creation" , func () {
9292 By ("simulating an invalid creation scenario" )
93- response := validator .OnCreate ( nil , reader , decoder , nil )( ctx , admission. Request {} )
93+ response := test . RunWebhook ( ctx , validator .OnCreate , reader , decoder )
9494 test .VerifyResponse (response , http .StatusForbidden , "approvalCondition is invalid: ERROR: <input>:1:1: undeclared reference to 'foo' (in container '')\n | foo.spec.reason == 'test'\n | ^" )
9595 })
9696 It ("Should deny update" , func () {
9797 By ("simulating an invalid update scenario" )
98- response := validator .OnUpdate ( nil , reader , decoder , nil )( ctx , admission. Request {} )
98+ response := test . RunWebhook ( ctx , validator .OnUpdate , reader , decoder )
9999 test .VerifyResponse (response , http .StatusForbidden , "approvalCondition is invalid: ERROR: <input>:1:1: undeclared reference to 'foo' (in container '')\n | foo.spec.reason == 'test'\n | ^" )
100100 })
101101 })
@@ -107,12 +107,12 @@ var _ = Describe("BreakRequestTemplate Webhook", func() {
107107 })
108108 It ("Should allow creation" , func () {
109109 By ("simulating an valid creation scenario" )
110- response := validator .OnCreate ( nil , reader , decoder , nil )( ctx , admission. Request {} )
110+ response := test . RunWebhook ( ctx , validator .OnCreate , reader , decoder )
111111 Expect (response ).To (BeNil ())
112112 })
113113 It ("Should allow update" , func () {
114114 By ("simulating an valid update scenario" )
115- response := validator .OnUpdate ( nil , reader , decoder , nil )( ctx , admission. Request {} )
115+ response := test . RunWebhook ( ctx , validator .OnUpdate , reader , decoder )
116116 Expect (response ).To (BeNil ())
117117 })
118118 })
0 commit comments