mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-30 20:02:24 -05:00 
			
		
		
		
	Update webfingering a little, add tests (#236)
* Update webfingering a little, add tests * fix broken tests oops
This commit is contained in:
		
					parent
					
						
							
								92186c8c6f
							
						
					
				
			
			
				commit
				
					
						b315eee43b
					
				
			
		
					 9 changed files with 325 additions and 74 deletions
				
			
		|  | @ -15,7 +15,6 @@ import ( | |||
| 	"github.com/stretchr/testify/assert" | ||||
| 	"github.com/stretchr/testify/suite" | ||||
| 	"github.com/superseriousbusiness/gotosocial/internal/api/s2s/user" | ||||
| 	"github.com/superseriousbusiness/gotosocial/internal/api/security" | ||||
| 	"github.com/superseriousbusiness/gotosocial/testrig" | ||||
| ) | ||||
| 
 | ||||
|  | @ -23,35 +22,6 @@ type RepliesGetTestSuite struct { | |||
| 	UserStandardTestSuite | ||||
| } | ||||
| 
 | ||||
| func (suite *RepliesGetTestSuite) SetupSuite() { | ||||
| 	suite.testTokens = testrig.NewTestTokens() | ||||
| 	suite.testClients = testrig.NewTestClients() | ||||
| 	suite.testApplications = testrig.NewTestApplications() | ||||
| 	suite.testUsers = testrig.NewTestUsers() | ||||
| 	suite.testAccounts = testrig.NewTestAccounts() | ||||
| 	suite.testAttachments = testrig.NewTestAttachments() | ||||
| 	suite.testStatuses = testrig.NewTestStatuses() | ||||
| } | ||||
| 
 | ||||
| func (suite *RepliesGetTestSuite) SetupTest() { | ||||
| 	suite.config = testrig.NewTestConfig() | ||||
| 	suite.db = testrig.NewTestDB() | ||||
| 	suite.tc = testrig.NewTestTypeConverter(suite.db) | ||||
| 	suite.storage = testrig.NewTestStorage() | ||||
| 	suite.log = testrig.NewTestLog() | ||||
| 	suite.federator = testrig.NewTestFederator(suite.db, testrig.NewTestTransportController(testrig.NewMockHTTPClient(nil), suite.db), suite.storage) | ||||
| 	suite.processor = testrig.NewTestProcessor(suite.db, suite.storage, suite.federator) | ||||
| 	suite.userModule = user.New(suite.config, suite.processor, suite.log).(*user.Module) | ||||
| 	suite.securityModule = security.New(suite.config, suite.db, suite.log).(*security.Module) | ||||
| 	testrig.StandardDBSetup(suite.db, suite.testAccounts) | ||||
| 	testrig.StandardStorageSetup(suite.storage, "../../../../testrig/media") | ||||
| } | ||||
| 
 | ||||
| func (suite *RepliesGetTestSuite) TearDownTest() { | ||||
| 	testrig.StandardDBTeardown(suite.db) | ||||
| 	testrig.StandardStorageTeardown(suite.storage) | ||||
| } | ||||
| 
 | ||||
| func (suite *RepliesGetTestSuite) TestGetReplies() { | ||||
| 	// the dereference we're gonna use | ||||
| 	derefRequests := testrig.NewTestDereferenceRequests(suite.testAccounts) | ||||
|  |  | |||
|  | @ -12,9 +12,9 @@ import ( | |||
| 	"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" | ||||
| 	"github.com/superseriousbusiness/gotosocial/internal/processing" | ||||
| 	"github.com/superseriousbusiness/gotosocial/internal/typeutils" | ||||
| 	"github.com/superseriousbusiness/gotosocial/testrig" | ||||
| ) | ||||
| 
 | ||||
| // nolint | ||||
| type UserStandardTestSuite struct { | ||||
| 	// standard suite interfaces | ||||
| 	suite.Suite | ||||
|  | @ -39,3 +39,32 @@ type UserStandardTestSuite struct { | |||
| 	// module being tested | ||||
| 	userModule *user.Module | ||||
| } | ||||
| 
 | ||||
| func (suite *UserStandardTestSuite) SetupSuite() { | ||||
| 	suite.testTokens = testrig.NewTestTokens() | ||||
| 	suite.testClients = testrig.NewTestClients() | ||||
| 	suite.testApplications = testrig.NewTestApplications() | ||||
| 	suite.testUsers = testrig.NewTestUsers() | ||||
| 	suite.testAccounts = testrig.NewTestAccounts() | ||||
| 	suite.testAttachments = testrig.NewTestAttachments() | ||||
| 	suite.testStatuses = testrig.NewTestStatuses() | ||||
| } | ||||
| 
 | ||||
| func (suite *UserStandardTestSuite) SetupTest() { | ||||
| 	suite.config = testrig.NewTestConfig() | ||||
| 	suite.db = testrig.NewTestDB() | ||||
| 	suite.tc = testrig.NewTestTypeConverter(suite.db) | ||||
| 	suite.storage = testrig.NewTestStorage() | ||||
| 	suite.log = testrig.NewTestLog() | ||||
| 	suite.federator = testrig.NewTestFederator(suite.db, testrig.NewTestTransportController(testrig.NewMockHTTPClient(nil), suite.db), suite.storage) | ||||
| 	suite.processor = testrig.NewTestProcessor(suite.db, suite.storage, suite.federator) | ||||
| 	suite.userModule = user.New(suite.config, suite.processor, suite.log).(*user.Module) | ||||
| 	suite.securityModule = security.New(suite.config, suite.db, suite.log).(*security.Module) | ||||
| 	testrig.StandardDBSetup(suite.db, suite.testAccounts) | ||||
| 	testrig.StandardStorageSetup(suite.storage, "../../../../testrig/media") | ||||
| } | ||||
| 
 | ||||
| func (suite *UserStandardTestSuite) TearDownTest() { | ||||
| 	testrig.StandardDBTeardown(suite.db) | ||||
| 	testrig.StandardStorageTeardown(suite.storage) | ||||
| } | ||||
|  |  | |||
|  | @ -14,7 +14,6 @@ import ( | |||
| 	"github.com/stretchr/testify/assert" | ||||
| 	"github.com/stretchr/testify/suite" | ||||
| 	"github.com/superseriousbusiness/gotosocial/internal/api/s2s/user" | ||||
| 	"github.com/superseriousbusiness/gotosocial/internal/api/security" | ||||
| 	"github.com/superseriousbusiness/gotosocial/testrig" | ||||
| ) | ||||
| 
 | ||||
|  | @ -22,35 +21,6 @@ type UserGetTestSuite struct { | |||
| 	UserStandardTestSuite | ||||
| } | ||||
| 
 | ||||
| func (suite *UserGetTestSuite) SetupSuite() { | ||||
| 	suite.testTokens = testrig.NewTestTokens() | ||||
| 	suite.testClients = testrig.NewTestClients() | ||||
| 	suite.testApplications = testrig.NewTestApplications() | ||||
| 	suite.testUsers = testrig.NewTestUsers() | ||||
| 	suite.testAccounts = testrig.NewTestAccounts() | ||||
| 	suite.testAttachments = testrig.NewTestAttachments() | ||||
| 	suite.testStatuses = testrig.NewTestStatuses() | ||||
| } | ||||
| 
 | ||||
| func (suite *UserGetTestSuite) SetupTest() { | ||||
| 	suite.config = testrig.NewTestConfig() | ||||
| 	suite.db = testrig.NewTestDB() | ||||
| 	suite.tc = testrig.NewTestTypeConverter(suite.db) | ||||
| 	suite.storage = testrig.NewTestStorage() | ||||
| 	suite.log = testrig.NewTestLog() | ||||
| 	suite.federator = testrig.NewTestFederator(suite.db, testrig.NewTestTransportController(testrig.NewMockHTTPClient(nil), suite.db), suite.storage) | ||||
| 	suite.processor = testrig.NewTestProcessor(suite.db, suite.storage, suite.federator) | ||||
| 	suite.userModule = user.New(suite.config, suite.processor, suite.log).(*user.Module) | ||||
| 	suite.securityModule = security.New(suite.config, suite.db, suite.log).(*security.Module) | ||||
| 	testrig.StandardDBSetup(suite.db, suite.testAccounts) | ||||
| 	testrig.StandardStorageSetup(suite.storage, "../../../../testrig/media") | ||||
| } | ||||
| 
 | ||||
| func (suite *UserGetTestSuite) TearDownTest() { | ||||
| 	testrig.StandardDBTeardown(suite.db) | ||||
| 	testrig.StandardStorageTeardown(suite.storage) | ||||
| } | ||||
| 
 | ||||
| func (suite *UserGetTestSuite) TestGetUser() { | ||||
| 	// the dereference we're gonna use | ||||
| 	derefRequests := testrig.NewTestDereferenceRequests(suite.testAccounts) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue