mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-10-27 04:21:11 +00:00 
			
		
		
		
	- Expired artifacts are kept in the database but the artifact has been deleted from the storage. Ignore them for the quota calculation. - Added unit test. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7976 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Reviewed-by: Otto <otto@codeberg.org> Co-authored-by: Gusted <postmaster@gusted.xyz> Co-committed-by: Gusted <postmaster@gusted.xyz>
		
			
				
	
	
		
			23 lines
		
	
	
	
		
			551 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
	
		
			551 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright 2025 The Forgejo Authors. All rights reserved.
 | |
| // SPDX-License-Identifier: GPL-3.0-or-later
 | |
| 
 | |
| package quota
 | |
| 
 | |
| import (
 | |
| 	"testing"
 | |
| 
 | |
| 	"forgejo.org/models/unittest"
 | |
| 
 | |
| 	"github.com/stretchr/testify/assert"
 | |
| 	"github.com/stretchr/testify/require"
 | |
| )
 | |
| 
 | |
| func TestGetUsedForUser(t *testing.T) {
 | |
| 	defer unittest.OverrideFixtures("models/fixtures/TestGetUsedForUser/")()
 | |
| 	require.NoError(t, unittest.PrepareTestDatabase())
 | |
| 
 | |
| 	used, err := GetUsedForUser(t.Context(), 5)
 | |
| 	require.NoError(t, err)
 | |
| 
 | |
| 	assert.EqualValues(t, 4096, used.Size.Assets.Artifacts)
 | |
| }
 |