Back to Browse

6. Testing | Spring Security with SB3

4.0K views
Mar 15, 2023
19:08

Finally, we'll write some tests for our endpoints to make sure that everything is working correctly and we won't need to keep testing manually. We'll also make a couple of mock annotations that will simulate users with different roles and allow us to call endpoints from tests without logging in. https://github.com/rytis-codes/spring-security === Get My Gear On B&H === A-Camera: https://bhpho.to/3EYwxUu Gear on my desk: https://bhpho.to/4bnX1uq === Gear Used For This Video === Best Camera: https://amzn.to/4h9UbvG Lens 24-105mm F4 (B-Roll): https://amzn.to/3Y9V26X Lens 50mm F1.8 (Main Angle): https://amzn.to/3BY4tyK Lens 85mm F1.8 (Side Angle): https://amzn.to/3NwmC9s Lens 18mm F1.8 (Desk Angle): https://amzn.to/3U9zt5q Mic Rode VideoMic NTG: https://amzn.to/4eQCH6a Mic Rode Wireless Pro: https://amzn.to/4hbLt04 Mic Deity PR-2: https://amzn.to/3zT4eVl Timecode Deity TC-1: https://amzn.to/3UaxRYY Light Amaran 300c: https://amzn.to/4dQpFUI Dolly SmallRig Tripod Wheels: https://amzn.to/4dTRyv0 === Best Teleprompter Stuff === SmallRig Teleprompter: https://amzn.to/44x4SCR Best Remote: https://amzn.to/4f7kyke Premium Remote: https://amzn.to/3BP7aCW Teleprompter Pro App: https://cloudprompter.com/?ref=rytis === More Cool Stuff === Zhiyun CM15 Portable Light: https://eu.zhiyun-tech.com/products/cinepeer-cm15?ref=rytis 10%off Promo code: ZHIYUN10WSS 00:00 Intro 00:48 Public endpoint test 05:36 Secured endpoint not reachable 06:38 UnauthorizedHandler 08:32 Continue writing tests 08:59 Faking logged in user in tests 09:21 WithMockUser annotation 10:06 SecurityContextFactory 10:39 WithMockUser cont'd 11:31 SecurityContextFactory cont'd 13:19 Using WithMockUser in test 14:21 Testing admin endpoint 16:46 WithAdminUser annotation 17:46 Outro

Download

0 formats

No download links available.

6. Testing | Spring Security with SB3 | NatokHD