@@ -3,6 +3,7 @@ package coderd_test
3
3
import (
4
4
"bytes"
5
5
"context"
6
+ "encoding/json"
6
7
"fmt"
7
8
"net/http"
8
9
"net/http/httptest"
@@ -503,6 +504,45 @@ func TestMultiReplica_EmptyRelayAddress_DisabledDERP(t *testing.T) {
503
504
}
504
505
}
505
506
507
+ func TestSCIMDisabled (t * testing.T ) {
508
+ t .Parallel ()
509
+
510
+ cli , _ := coderdenttest .New (t , & coderdenttest.Options {})
511
+
512
+ checkPaths := []string {
513
+ "/scim/v2" ,
514
+ "/scim/v2/" ,
515
+ "/scim/v2/users" ,
516
+ "/scim/v2/Users" ,
517
+ "/scim/v2/Users/" ,
518
+ "/scim/v2/random/path/that/is/long" ,
519
+ "/scim/v2/random/path/that/is/long.txt" ,
520
+ }
521
+
522
+ for _ , p := range checkPaths {
523
+ p := p
524
+ t .Run (p , func (t * testing.T ) {
525
+ t .Parallel ()
526
+
527
+ u , err := cli .URL .Parse (p )
528
+ require .NoError (t , err )
529
+
530
+ req , err := http .NewRequestWithContext (context .Background (), http .MethodGet , u .String (), nil )
531
+ require .NoError (t , err )
532
+
533
+ resp , err := http .DefaultClient .Do (req )
534
+ require .NoError (t , err )
535
+ require .Equal (t , http .StatusNotFound , resp .StatusCode )
536
+
537
+ var apiError codersdk.Response
538
+ err = json .NewDecoder (resp .Body ).Decode (& apiError )
539
+ require .NoError (t , err )
540
+
541
+ require .Contains (t , apiError .Message , "SCIM is disabled" )
542
+ })
543
+ }
544
+ }
545
+
506
546
// testDBAuthzRole returns a context with a subject that has a role
507
547
// with permissions required for test setup.
508
548
func testDBAuthzRole (ctx context.Context ) context.Context {
0 commit comments