-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update mvc/authenticated-controller example
rel to: #1536 too Former-commit-id: 0ed36644ee2d6c27d90450700d9241eb1ba93c17
- Loading branch information
Showing
4 changed files
with
56 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/kataras/iris/v12/httptest" | ||
) | ||
|
||
func TestMVCOverlapping(t *testing.T) { | ||
app := newApp() | ||
|
||
e := httptest.New(t, app, httptest.URL("http://example.com")) | ||
// unauthenticated. | ||
e.GET("/user").Expect().Status(httptest.StatusOK).Body().Equal("custom action to redirect on authentication page") | ||
// login. | ||
e.POST("/user/login").Expect().Status(httptest.StatusOK) | ||
// authenticated. | ||
e.GET("/user").Expect().Status(httptest.StatusOK).Body().Equal(`UserController.Get: The Authenticated type | ||
can be used to secure a controller's method too.`) | ||
// logout. | ||
e.POST("/user/logout").Expect().Status(httptest.StatusOK) | ||
// unauthenticated. | ||
e.GET("/user").Expect().Status(httptest.StatusOK).Body().Equal("custom action to redirect on authentication page") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters