mirror of
				https://github.com/photoprism/photoprism.git
				synced 2025-10-31 20:22:55 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			29 lines
		
	
	
		
			665 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			665 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package api
 | |
| 
 | |
| import (
 | |
| 	"net/http"
 | |
| 	"testing"
 | |
| 
 | |
| 	"github.com/stretchr/testify/assert"
 | |
| )
 | |
| 
 | |
| func TestGetErrors(t *testing.T) {
 | |
| 	t.Run("successful request", func(t *testing.T) {
 | |
| 		app, router, _ := NewApiTest()
 | |
| 		GetErrors(router)
 | |
| 		r := PerformRequest(app, "GET", "/api/v1/errors")
 | |
| 		// Ok if no error is thrown.
 | |
| 		assert.Equal(t, http.StatusOK, r.Code)
 | |
| 	})
 | |
| }
 | |
| 
 | |
| func TestDeleteErrors(t *testing.T) {
 | |
| 	t.Run("successful request", func(t *testing.T) {
 | |
| 		app, router, _ := NewApiTest()
 | |
| 		DeleteErrors(router)
 | |
| 		r := PerformRequest(app, "DELETE", "/api/v1/errors")
 | |
| 		// Disabled in public mode, so error 403 is expected.
 | |
| 		assert.Equal(t, http.StatusForbidden, r.Code)
 | |
| 	})
 | |
| }
 | 
