@@ -369,7 +369,7 @@ async fn test_vpc_limited_collaborator_role(
369369
370370 // Test 4: User with silo.limited-collaborator role CANNOT create a VPC
371371 // (inherits project.limited-collaborator, which cannot modify networking)
372- let error : HttpErrorResponseBody = NexusRequest :: new (
372+ NexusRequest :: new (
373373 RequestBuilder :: new ( client, Method :: POST , & vpcs_url)
374374 . body ( Some ( & params:: VpcCreate {
375375 identity : IdentityMetadataCreateParams {
@@ -384,10 +384,7 @@ async fn test_vpc_limited_collaborator_role(
384384 . authn_as ( AuthnMode :: SiloUser ( limited_user. id ) )
385385 . execute ( )
386386 . await
387- . expect ( "request should complete" )
388- . parsed_body ( )
389- . unwrap ( ) ;
390- assert_eq ! ( error. message, "Forbidden" ) ;
387+ . expect ( "silo limited-collaborator should not be able to create VPC" ) ;
391388}
392389
393390#[ nexus_test]
@@ -528,7 +525,7 @@ async fn test_limited_collaborator_blocked_from_networking_resources(
528525
529526 // Test 0: Cannot create VPC
530527 let vpcs_url = format ! ( "/v1/vpcs?project={}" , project_name) ;
531- let error : HttpErrorResponseBody = NexusRequest :: new (
528+ NexusRequest :: new (
532529 RequestBuilder :: new ( client, Method :: POST , & vpcs_url)
533530 . body ( Some ( & params:: VpcCreate {
534531 identity : IdentityMetadataCreateParams {
@@ -543,15 +540,12 @@ async fn test_limited_collaborator_blocked_from_networking_resources(
543540 . authn_as ( AuthnMode :: SiloUser ( limited_user. id ) )
544541 . execute ( )
545542 . await
546- . expect ( "request should complete" )
547- . parsed_body ( )
548- . unwrap ( ) ;
549- assert_eq ! ( error. message, "Forbidden" ) ;
543+ . expect ( "limited collaborator should not be able to create VPC" ) ;
550544
551545 // Test 1: Cannot create VPC subnet
552546 let subnets_url =
553547 format ! ( "/v1/vpc-subnets?project={}&vpc=default" , project_name) ;
554- let error : HttpErrorResponseBody = NexusRequest :: new (
548+ NexusRequest :: new (
555549 RequestBuilder :: new ( client, Method :: POST , & subnets_url)
556550 . body ( Some ( & params:: VpcSubnetCreate {
557551 identity : IdentityMetadataCreateParams {
@@ -567,15 +561,12 @@ async fn test_limited_collaborator_blocked_from_networking_resources(
567561 . authn_as ( AuthnMode :: SiloUser ( limited_user. id ) )
568562 . execute ( )
569563 . await
570- . expect ( "request should complete" )
571- . parsed_body ( )
572- . unwrap ( ) ;
573- assert_eq ! ( error. message, "Forbidden" ) ;
564+ . expect ( "limited collaborator should not be able to create VPC subnet" ) ;
574565
575566 // Test 2: Cannot create VPC router
576567 let routers_url =
577568 format ! ( "/v1/vpc-routers?project={}&vpc=default" , project_name) ;
578- let error : HttpErrorResponseBody = NexusRequest :: new (
569+ NexusRequest :: new (
579570 RequestBuilder :: new ( client, Method :: POST , & routers_url)
580571 . body ( Some ( & params:: VpcRouterCreate {
581572 identity : IdentityMetadataCreateParams {
@@ -588,15 +579,12 @@ async fn test_limited_collaborator_blocked_from_networking_resources(
588579 . authn_as ( AuthnMode :: SiloUser ( limited_user. id ) )
589580 . execute ( )
590581 . await
591- . expect ( "request should complete" )
592- . parsed_body ( )
593- . unwrap ( ) ;
594- assert_eq ! ( error. message, "Forbidden" ) ;
582+ . expect ( "limited collaborator should not be able to create VPC router" ) ;
595583
596584 // Test 3: Cannot create internet gateway
597585 let igw_url =
598586 format ! ( "/v1/internet-gateways?project={}&vpc=default" , project_name) ;
599- let error : HttpErrorResponseBody = NexusRequest :: new (
587+ NexusRequest :: new (
600588 RequestBuilder :: new ( client, Method :: POST , & igw_url)
601589 . body ( Some ( & params:: InternetGatewayCreate {
602590 identity : IdentityMetadataCreateParams {
@@ -609,10 +597,7 @@ async fn test_limited_collaborator_blocked_from_networking_resources(
609597 . authn_as ( AuthnMode :: SiloUser ( limited_user. id ) )
610598 . execute ( )
611599 . await
612- . expect ( "request should complete" )
613- . parsed_body ( )
614- . unwrap ( ) ;
615- assert_eq ! ( error. message, "Forbidden" ) ;
600+ . expect ( "limited collaborator should not be able to create internet gateway" ) ;
616601
617602 // Setup for remaining tests: Create IGW and router as privileged user
618603 let igw_name = "test-gateway" ;
@@ -656,7 +641,7 @@ async fn test_limited_collaborator_blocked_from_networking_resources(
656641 "/v1/vpc-router-routes?project={}&vpc=default&router={}" ,
657642 project_name, router_name
658643 ) ;
659- let error : HttpErrorResponseBody = NexusRequest :: new (
644+ NexusRequest :: new (
660645 RequestBuilder :: new ( client, Method :: POST , & routes_url)
661646 . body ( Some ( & params:: RouterRouteCreate {
662647 identity : IdentityMetadataCreateParams {
@@ -671,17 +656,14 @@ async fn test_limited_collaborator_blocked_from_networking_resources(
671656 . authn_as ( AuthnMode :: SiloUser ( limited_user. id ) )
672657 . execute ( )
673658 . await
674- . expect ( "request should complete" )
675- . parsed_body ( )
676- . unwrap ( ) ;
677- assert_eq ! ( error. message, "Forbidden" ) ;
659+ . expect ( "limited collaborator should not be able to create router route" ) ;
678660
679661 // Test 5: Cannot attach IP pool to internet gateway
680662 let pool_attach_url = format ! (
681663 "/v1/internet-gateway-ip-pools?project={}&vpc=default&gateway={}" ,
682664 project_name, igw_name
683665 ) ;
684- let error : HttpErrorResponseBody = NexusRequest :: new (
666+ NexusRequest :: new (
685667 RequestBuilder :: new ( client, Method :: POST , & pool_attach_url)
686668 . body ( Some ( & params:: InternetGatewayIpPoolCreate {
687669 identity : IdentityMetadataCreateParams {
@@ -695,10 +677,7 @@ async fn test_limited_collaborator_blocked_from_networking_resources(
695677 . authn_as ( AuthnMode :: SiloUser ( limited_user. id ) )
696678 . execute ( )
697679 . await
698- . expect ( "request should complete" )
699- . parsed_body ( )
700- . unwrap ( ) ;
701- assert_eq ! ( error. message, "Forbidden" ) ;
680+ . expect ( "limited collaborator should not be able to attach IP pool to internet gateway" ) ;
702681
703682 // Test 6: Cannot modify VPC firewall rules
704683 let firewall_url =
@@ -721,18 +700,15 @@ async fn test_limited_collaborator_blocked_from_networking_resources(
721700 priority: VpcFirewallRulePriority ( 100 ) ,
722701 } ] ,
723702 } ;
724- let error : HttpErrorResponseBody = NexusRequest :: new (
703+ NexusRequest :: new (
725704 RequestBuilder :: new ( client, Method :: PUT , & firewall_url)
726705 . body ( Some ( & new_rules) )
727706 . expect_status ( Some ( StatusCode :: FORBIDDEN ) ) ,
728707 )
729708 . authn_as ( AuthnMode :: SiloUser ( limited_user. id ) )
730709 . execute ( )
731710 . await
732- . expect ( "request should complete" )
733- . parsed_body ( )
734- . unwrap ( ) ;
735- assert_eq ! ( error. message, "Forbidden" ) ;
711+ . expect ( "limited collaborator should not be able to modify VPC firewall rules" ) ;
736712}
737713
738714#[ nexus_test]
0 commit comments