Home / Function/ Test_ScopeValidation() — fiber Function Reference

Test_ScopeValidation() — fiber Function Reference

Architecture documentation for the Test_ScopeValidation() function in keyauth_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  8ae83bb0_6823_fdf1_ef90_ebbd9d674922["Test_ScopeValidation()"]
  71f55784_a001_0646_0ce7_7ad97067c49c["keyauth_test.go"]
  8ae83bb0_6823_fdf1_ef90_ebbd9d674922 -->|defined in| 71f55784_a001_0646_0ce7_7ad97067c49c
  style 8ae83bb0_6823_fdf1_ef90_ebbd9d674922 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/keyauth/keyauth_test.go lines 964–994

func Test_ScopeValidation(t *testing.T) {
	require.PanicsWithValue(t, "fiber: keyauth scope requires insufficient_scope error", func() {
		New(Config{
			Validator: func(_ fiber.Ctx, _ string) (bool, error) { return true, nil },
			Scope:     "foo",
		})
	})

	require.PanicsWithValue(t, "fiber: keyauth insufficient_scope requires scope", func() {
		New(Config{
			Validator: func(_ fiber.Ctx, _ string) (bool, error) { return true, nil },
			Error:     ErrorInsufficientScope,
		})
	})

	require.PanicsWithValue(t, "fiber: keyauth scope contains invalid token", func() {
		New(Config{
			Validator: func(_ fiber.Ctx, _ string) (bool, error) { return true, nil },
			Error:     ErrorInsufficientScope,
			Scope:     "read \"write\"",
		})
	})

	require.NotPanics(t, func() {
		New(Config{
			Validator: func(_ fiber.Ctx, _ string) (bool, error) { return true, nil },
			Error:     ErrorInsufficientScope,
			Scope:     "read write:all",
		})
	})
}

Domain

Subdomains

Frequently Asked Questions

What does Test_ScopeValidation() do?
Test_ScopeValidation() is a function in the fiber codebase, defined in middleware/keyauth/keyauth_test.go.
Where is Test_ScopeValidation() defined?
Test_ScopeValidation() is defined in middleware/keyauth/keyauth_test.go at line 964.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free