mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-11-03 22:12:26 -06:00 
			
		
		
		
	This PR adds:
Statuses
    New status creation.
    View existing status
    Delete a status
    Fave a status
    Unfave a status
    See who's faved a status
Media
    Upload media attachment and store/retrieve it
    Upload custom emoji and store/retrieve it
Fileserver
    Serve files from storage
Testing
    Test models, testrig -- run a GTS test instance and play around with it.
		
	
			
		
			
				
	
	
		
			484 lines
		
	
	
	
		
			12 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			484 lines
		
	
	
	
		
			12 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
// Code generated by mockery v2.7.4. DO NOT EDIT.
 | 
						|
 | 
						|
package db
 | 
						|
 | 
						|
import (
 | 
						|
	context "context"
 | 
						|
 | 
						|
	mock "github.com/stretchr/testify/mock"
 | 
						|
	gtsmodel "github.com/superseriousbusiness/gotosocial/internal/db/gtsmodel"
 | 
						|
 | 
						|
	net "net"
 | 
						|
 | 
						|
	pub "github.com/go-fed/activity/pub"
 | 
						|
)
 | 
						|
 | 
						|
// MockDB is an autogenerated mock type for the DB type
 | 
						|
type MockDB struct {
 | 
						|
	mock.Mock
 | 
						|
}
 | 
						|
 | 
						|
// Blocked provides a mock function with given fields: account1, account2
 | 
						|
func (_m *MockDB) Blocked(account1 string, account2 string) (bool, error) {
 | 
						|
	ret := _m.Called(account1, account2)
 | 
						|
 | 
						|
	var r0 bool
 | 
						|
	if rf, ok := ret.Get(0).(func(string, string) bool); ok {
 | 
						|
		r0 = rf(account1, account2)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Get(0).(bool)
 | 
						|
	}
 | 
						|
 | 
						|
	var r1 error
 | 
						|
	if rf, ok := ret.Get(1).(func(string, string) error); ok {
 | 
						|
		r1 = rf(account1, account2)
 | 
						|
	} else {
 | 
						|
		r1 = ret.Error(1)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0, r1
 | 
						|
}
 | 
						|
 | 
						|
// CreateTable provides a mock function with given fields: i
 | 
						|
func (_m *MockDB) CreateTable(i interface{}) error {
 | 
						|
	ret := _m.Called(i)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(interface{}) error); ok {
 | 
						|
		r0 = rf(i)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// DeleteByID provides a mock function with given fields: id, i
 | 
						|
func (_m *MockDB) DeleteByID(id string, i interface{}) error {
 | 
						|
	ret := _m.Called(id, i)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(string, interface{}) error); ok {
 | 
						|
		r0 = rf(id, i)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// DeleteWhere provides a mock function with given fields: key, value, i
 | 
						|
func (_m *MockDB) DeleteWhere(key string, value interface{}, i interface{}) error {
 | 
						|
	ret := _m.Called(key, value, i)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(string, interface{}, interface{}) error); ok {
 | 
						|
		r0 = rf(key, value, i)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// DropTable provides a mock function with given fields: i
 | 
						|
func (_m *MockDB) DropTable(i interface{}) error {
 | 
						|
	ret := _m.Called(i)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(interface{}) error); ok {
 | 
						|
		r0 = rf(i)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// EmojiStringsToEmojis provides a mock function with given fields: emojis, originAccountID, statusID
 | 
						|
func (_m *MockDB) EmojiStringsToEmojis(emojis []string, originAccountID string, statusID string) ([]*gtsmodel.Emoji, error) {
 | 
						|
	ret := _m.Called(emojis, originAccountID, statusID)
 | 
						|
 | 
						|
	var r0 []*gtsmodel.Emoji
 | 
						|
	if rf, ok := ret.Get(0).(func([]string, string, string) []*gtsmodel.Emoji); ok {
 | 
						|
		r0 = rf(emojis, originAccountID, statusID)
 | 
						|
	} else {
 | 
						|
		if ret.Get(0) != nil {
 | 
						|
			r0 = ret.Get(0).([]*gtsmodel.Emoji)
 | 
						|
		}
 | 
						|
	}
 | 
						|
 | 
						|
	var r1 error
 | 
						|
	if rf, ok := ret.Get(1).(func([]string, string, string) error); ok {
 | 
						|
		r1 = rf(emojis, originAccountID, statusID)
 | 
						|
	} else {
 | 
						|
		r1 = ret.Error(1)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0, r1
 | 
						|
}
 | 
						|
 | 
						|
// Federation provides a mock function with given fields:
 | 
						|
func (_m *MockDB) Federation() pub.Database {
 | 
						|
	ret := _m.Called()
 | 
						|
 | 
						|
	var r0 pub.Database
 | 
						|
	if rf, ok := ret.Get(0).(func() pub.Database); ok {
 | 
						|
		r0 = rf()
 | 
						|
	} else {
 | 
						|
		if ret.Get(0) != nil {
 | 
						|
			r0 = ret.Get(0).(pub.Database)
 | 
						|
		}
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// GetAccountByUserID provides a mock function with given fields: userID, account
 | 
						|
func (_m *MockDB) GetAccountByUserID(userID string, account *gtsmodel.Account) error {
 | 
						|
	ret := _m.Called(userID, account)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(string, *gtsmodel.Account) error); ok {
 | 
						|
		r0 = rf(userID, account)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// GetAll provides a mock function with given fields: i
 | 
						|
func (_m *MockDB) GetAll(i interface{}) error {
 | 
						|
	ret := _m.Called(i)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(interface{}) error); ok {
 | 
						|
		r0 = rf(i)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// GetAvatarForAccountID provides a mock function with given fields: avatar, accountID
 | 
						|
func (_m *MockDB) GetAvatarForAccountID(avatar *gtsmodel.MediaAttachment, accountID string) error {
 | 
						|
	ret := _m.Called(avatar, accountID)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(*gtsmodel.MediaAttachment, string) error); ok {
 | 
						|
		r0 = rf(avatar, accountID)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// GetByID provides a mock function with given fields: id, i
 | 
						|
func (_m *MockDB) GetByID(id string, i interface{}) error {
 | 
						|
	ret := _m.Called(id, i)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(string, interface{}) error); ok {
 | 
						|
		r0 = rf(id, i)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// GetFollowRequestsForAccountID provides a mock function with given fields: accountID, followRequests
 | 
						|
func (_m *MockDB) GetFollowRequestsForAccountID(accountID string, followRequests *[]gtsmodel.FollowRequest) error {
 | 
						|
	ret := _m.Called(accountID, followRequests)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(string, *[]gtsmodel.FollowRequest) error); ok {
 | 
						|
		r0 = rf(accountID, followRequests)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// GetFollowersByAccountID provides a mock function with given fields: accountID, followers
 | 
						|
func (_m *MockDB) GetFollowersByAccountID(accountID string, followers *[]gtsmodel.Follow) error {
 | 
						|
	ret := _m.Called(accountID, followers)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(string, *[]gtsmodel.Follow) error); ok {
 | 
						|
		r0 = rf(accountID, followers)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// GetFollowingByAccountID provides a mock function with given fields: accountID, following
 | 
						|
func (_m *MockDB) GetFollowingByAccountID(accountID string, following *[]gtsmodel.Follow) error {
 | 
						|
	ret := _m.Called(accountID, following)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(string, *[]gtsmodel.Follow) error); ok {
 | 
						|
		r0 = rf(accountID, following)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// GetHeaderForAccountID provides a mock function with given fields: header, accountID
 | 
						|
func (_m *MockDB) GetHeaderForAccountID(header *gtsmodel.MediaAttachment, accountID string) error {
 | 
						|
	ret := _m.Called(header, accountID)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(*gtsmodel.MediaAttachment, string) error); ok {
 | 
						|
		r0 = rf(header, accountID)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// GetLastStatusForAccountID provides a mock function with given fields: accountID, status
 | 
						|
func (_m *MockDB) GetLastStatusForAccountID(accountID string, status *gtsmodel.Status) error {
 | 
						|
	ret := _m.Called(accountID, status)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(string, *gtsmodel.Status) error); ok {
 | 
						|
		r0 = rf(accountID, status)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// GetStatusesByAccountID provides a mock function with given fields: accountID, statuses
 | 
						|
func (_m *MockDB) GetStatusesByAccountID(accountID string, statuses *[]gtsmodel.Status) error {
 | 
						|
	ret := _m.Called(accountID, statuses)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(string, *[]gtsmodel.Status) error); ok {
 | 
						|
		r0 = rf(accountID, statuses)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// GetStatusesByTimeDescending provides a mock function with given fields: accountID, statuses, limit
 | 
						|
func (_m *MockDB) GetStatusesByTimeDescending(accountID string, statuses *[]gtsmodel.Status, limit int) error {
 | 
						|
	ret := _m.Called(accountID, statuses, limit)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(string, *[]gtsmodel.Status, int) error); ok {
 | 
						|
		r0 = rf(accountID, statuses, limit)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// GetWhere provides a mock function with given fields: key, value, i
 | 
						|
func (_m *MockDB) GetWhere(key string, value interface{}, i interface{}) error {
 | 
						|
	ret := _m.Called(key, value, i)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(string, interface{}, interface{}) error); ok {
 | 
						|
		r0 = rf(key, value, i)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// IsEmailAvailable provides a mock function with given fields: email
 | 
						|
func (_m *MockDB) IsEmailAvailable(email string) error {
 | 
						|
	ret := _m.Called(email)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(string) error); ok {
 | 
						|
		r0 = rf(email)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// IsHealthy provides a mock function with given fields: ctx
 | 
						|
func (_m *MockDB) IsHealthy(ctx context.Context) error {
 | 
						|
	ret := _m.Called(ctx)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(context.Context) error); ok {
 | 
						|
		r0 = rf(ctx)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// IsUsernameAvailable provides a mock function with given fields: username
 | 
						|
func (_m *MockDB) IsUsernameAvailable(username string) error {
 | 
						|
	ret := _m.Called(username)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(string) error); ok {
 | 
						|
		r0 = rf(username)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// MentionStringsToMentions provides a mock function with given fields: targetAccounts, originAccountID, statusID
 | 
						|
func (_m *MockDB) MentionStringsToMentions(targetAccounts []string, originAccountID string, statusID string) ([]*gtsmodel.Mention, error) {
 | 
						|
	ret := _m.Called(targetAccounts, originAccountID, statusID)
 | 
						|
 | 
						|
	var r0 []*gtsmodel.Mention
 | 
						|
	if rf, ok := ret.Get(0).(func([]string, string, string) []*gtsmodel.Mention); ok {
 | 
						|
		r0 = rf(targetAccounts, originAccountID, statusID)
 | 
						|
	} else {
 | 
						|
		if ret.Get(0) != nil {
 | 
						|
			r0 = ret.Get(0).([]*gtsmodel.Mention)
 | 
						|
		}
 | 
						|
	}
 | 
						|
 | 
						|
	var r1 error
 | 
						|
	if rf, ok := ret.Get(1).(func([]string, string, string) error); ok {
 | 
						|
		r1 = rf(targetAccounts, originAccountID, statusID)
 | 
						|
	} else {
 | 
						|
		r1 = ret.Error(1)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0, r1
 | 
						|
}
 | 
						|
 | 
						|
// NewSignup provides a mock function with given fields: username, reason, requireApproval, email, password, signUpIP, locale, appID
 | 
						|
func (_m *MockDB) NewSignup(username string, reason string, requireApproval bool, email string, password string, signUpIP net.IP, locale string, appID string) (*gtsmodel.User, error) {
 | 
						|
	ret := _m.Called(username, reason, requireApproval, email, password, signUpIP, locale, appID)
 | 
						|
 | 
						|
	var r0 *gtsmodel.User
 | 
						|
	if rf, ok := ret.Get(0).(func(string, string, bool, string, string, net.IP, string, string) *gtsmodel.User); ok {
 | 
						|
		r0 = rf(username, reason, requireApproval, email, password, signUpIP, locale, appID)
 | 
						|
	} else {
 | 
						|
		if ret.Get(0) != nil {
 | 
						|
			r0 = ret.Get(0).(*gtsmodel.User)
 | 
						|
		}
 | 
						|
	}
 | 
						|
 | 
						|
	var r1 error
 | 
						|
	if rf, ok := ret.Get(1).(func(string, string, bool, string, string, net.IP, string, string) error); ok {
 | 
						|
		r1 = rf(username, reason, requireApproval, email, password, signUpIP, locale, appID)
 | 
						|
	} else {
 | 
						|
		r1 = ret.Error(1)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0, r1
 | 
						|
}
 | 
						|
 | 
						|
// Put provides a mock function with given fields: i
 | 
						|
func (_m *MockDB) Put(i interface{}) error {
 | 
						|
	ret := _m.Called(i)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(interface{}) error); ok {
 | 
						|
		r0 = rf(i)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// SetHeaderOrAvatarForAccountID provides a mock function with given fields: mediaAttachment, accountID
 | 
						|
func (_m *MockDB) SetHeaderOrAvatarForAccountID(mediaAttachment *gtsmodel.MediaAttachment, accountID string) error {
 | 
						|
	ret := _m.Called(mediaAttachment, accountID)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(*gtsmodel.MediaAttachment, string) error); ok {
 | 
						|
		r0 = rf(mediaAttachment, accountID)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// Stop provides a mock function with given fields: ctx
 | 
						|
func (_m *MockDB) Stop(ctx context.Context) error {
 | 
						|
	ret := _m.Called(ctx)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(context.Context) error); ok {
 | 
						|
		r0 = rf(ctx)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// TagStringsToTags provides a mock function with given fields: tags, originAccountID, statusID
 | 
						|
func (_m *MockDB) TagStringsToTags(tags []string, originAccountID string, statusID string) ([]*gtsmodel.Tag, error) {
 | 
						|
	ret := _m.Called(tags, originAccountID, statusID)
 | 
						|
 | 
						|
	var r0 []*gtsmodel.Tag
 | 
						|
	if rf, ok := ret.Get(0).(func([]string, string, string) []*gtsmodel.Tag); ok {
 | 
						|
		r0 = rf(tags, originAccountID, statusID)
 | 
						|
	} else {
 | 
						|
		if ret.Get(0) != nil {
 | 
						|
			r0 = ret.Get(0).([]*gtsmodel.Tag)
 | 
						|
		}
 | 
						|
	}
 | 
						|
 | 
						|
	var r1 error
 | 
						|
	if rf, ok := ret.Get(1).(func([]string, string, string) error); ok {
 | 
						|
		r1 = rf(tags, originAccountID, statusID)
 | 
						|
	} else {
 | 
						|
		r1 = ret.Error(1)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0, r1
 | 
						|
}
 | 
						|
 | 
						|
// UpdateByID provides a mock function with given fields: id, i
 | 
						|
func (_m *MockDB) UpdateByID(id string, i interface{}) error {
 | 
						|
	ret := _m.Called(id, i)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(string, interface{}) error); ok {
 | 
						|
		r0 = rf(id, i)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 | 
						|
 | 
						|
// UpdateOneByID provides a mock function with given fields: id, key, value, i
 | 
						|
func (_m *MockDB) UpdateOneByID(id string, key string, value interface{}, i interface{}) error {
 | 
						|
	ret := _m.Called(id, key, value, i)
 | 
						|
 | 
						|
	var r0 error
 | 
						|
	if rf, ok := ret.Get(0).(func(string, string, interface{}, interface{}) error); ok {
 | 
						|
		r0 = rf(id, key, value, i)
 | 
						|
	} else {
 | 
						|
		r0 = ret.Error(0)
 | 
						|
	}
 | 
						|
 | 
						|
	return r0
 | 
						|
}
 |