mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-11-04 00:11:04 +00:00 
			
		
		
		
	- Use mock helper functions, instead of home-brew solutions. - Disable cron jobs that are not important to be run during integration tests and might even interfere. - Avoid sleeping unnecessary, if there's some requirement then sleep or retry until that requirement is met. - Avoid trying to deliver webhooks that will always result in a failure. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7917 Reviewed-by: Michael Kriese <michael.kriese@gmx.de> Co-authored-by: Gusted <postmaster@gusted.xyz> Co-committed-by: Gusted <postmaster@gusted.xyz>
		
			
				
	
	
		
			25 lines
		
	
	
	
		
			653 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
	
		
			653 B
		
	
	
	
		
			Go
		
	
	
	
	
	
// Copyright 2021 The Gitea Authors. All rights reserved.
 | 
						|
// SPDX-License-Identifier: MIT
 | 
						|
 | 
						|
package webauthn
 | 
						|
 | 
						|
import (
 | 
						|
	"testing"
 | 
						|
 | 
						|
	"forgejo.org/modules/setting"
 | 
						|
	"forgejo.org/modules/test"
 | 
						|
 | 
						|
	"github.com/stretchr/testify/assert"
 | 
						|
)
 | 
						|
 | 
						|
func TestInit(t *testing.T) {
 | 
						|
	defer test.MockVariableValue(&setting.Domain, "domain")()
 | 
						|
	defer test.MockVariableValue(&setting.AppName, "AppName")()
 | 
						|
	defer test.MockVariableValue(&setting.AppURL, "https://domain/")()
 | 
						|
 | 
						|
	Init()
 | 
						|
 | 
						|
	assert.Equal(t, setting.Domain, WebAuthn.Config.RPID)
 | 
						|
	assert.Equal(t, setting.AppName, WebAuthn.Config.RPDisplayName)
 | 
						|
	assert.Equal(t, []string{"https://domain"}, WebAuthn.Config.RPOrigins)
 | 
						|
}
 |