mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-01 03:03:10 -06:00
Remove more of the dead query API call
This commit is contained in:
parent
421d819d83
commit
59365c87c3
|
|
@ -93,11 +93,10 @@ func (o *testEDUProducer) InputCrossSigningKeyUpdate(
|
||||||
|
|
||||||
type testRoomserverAPI struct {
|
type testRoomserverAPI struct {
|
||||||
api.RoomserverInternalAPITrace
|
api.RoomserverInternalAPITrace
|
||||||
inputRoomEvents []api.InputRoomEvent
|
inputRoomEvents []api.InputRoomEvent
|
||||||
queryMissingAuthPrevEvents func(*api.QueryMissingAuthPrevEventsRequest) api.QueryMissingAuthPrevEventsResponse
|
queryStateAfterEvents func(*api.QueryStateAfterEventsRequest) api.QueryStateAfterEventsResponse
|
||||||
queryStateAfterEvents func(*api.QueryStateAfterEventsRequest) api.QueryStateAfterEventsResponse
|
queryEventsByID func(req *api.QueryEventsByIDRequest) api.QueryEventsByIDResponse
|
||||||
queryEventsByID func(req *api.QueryEventsByIDRequest) api.QueryEventsByIDResponse
|
queryLatestEventsAndState func(*api.QueryLatestEventsAndStateRequest) api.QueryLatestEventsAndStateResponse
|
||||||
queryLatestEventsAndState func(*api.QueryLatestEventsAndStateRequest) api.QueryLatestEventsAndStateResponse
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *testRoomserverAPI) InputRoomEvents(
|
func (t *testRoomserverAPI) InputRoomEvents(
|
||||||
|
|
@ -140,20 +139,6 @@ func (t *testRoomserverAPI) QueryStateAfterEvents(
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Query the state after a list of events in a room from the room server.
|
|
||||||
func (t *testRoomserverAPI) QueryMissingAuthPrevEvents(
|
|
||||||
ctx context.Context,
|
|
||||||
request *api.QueryMissingAuthPrevEventsRequest,
|
|
||||||
response *api.QueryMissingAuthPrevEventsResponse,
|
|
||||||
) error {
|
|
||||||
response.RoomVersion = testRoomVersion
|
|
||||||
res := t.queryMissingAuthPrevEvents(request)
|
|
||||||
response.RoomExists = res.RoomExists
|
|
||||||
response.MissingAuthEventIDs = res.MissingAuthEventIDs
|
|
||||||
response.MissingPrevEventIDs = res.MissingPrevEventIDs
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Query a list of events by event ID.
|
// Query a list of events by event ID.
|
||||||
func (t *testRoomserverAPI) QueryEventsByID(
|
func (t *testRoomserverAPI) QueryEventsByID(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
|
|
@ -312,15 +297,7 @@ func assertInputRoomEvents(t *testing.T, got []api.InputRoomEvent, want []*gomat
|
||||||
// The purpose of this test is to check that receiving an event over federation for which we have the prev_events works correctly, and passes it on
|
// The purpose of this test is to check that receiving an event over federation for which we have the prev_events works correctly, and passes it on
|
||||||
// to the roomserver. It's the most basic test possible.
|
// to the roomserver. It's the most basic test possible.
|
||||||
func TestBasicTransaction(t *testing.T) {
|
func TestBasicTransaction(t *testing.T) {
|
||||||
rsAPI := &testRoomserverAPI{
|
rsAPI := &testRoomserverAPI{}
|
||||||
queryMissingAuthPrevEvents: func(req *api.QueryMissingAuthPrevEventsRequest) api.QueryMissingAuthPrevEventsResponse {
|
|
||||||
return api.QueryMissingAuthPrevEventsResponse{
|
|
||||||
RoomExists: true,
|
|
||||||
MissingAuthEventIDs: []string{},
|
|
||||||
MissingPrevEventIDs: []string{},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
pdus := []json.RawMessage{
|
pdus := []json.RawMessage{
|
||||||
testData[len(testData)-1], // a message event
|
testData[len(testData)-1], // a message event
|
||||||
}
|
}
|
||||||
|
|
@ -332,15 +309,7 @@ func TestBasicTransaction(t *testing.T) {
|
||||||
// The purpose of this test is to check that if the event received fails auth checks the event is still sent to the roomserver
|
// The purpose of this test is to check that if the event received fails auth checks the event is still sent to the roomserver
|
||||||
// as it does the auth check.
|
// as it does the auth check.
|
||||||
func TestTransactionFailAuthChecks(t *testing.T) {
|
func TestTransactionFailAuthChecks(t *testing.T) {
|
||||||
rsAPI := &testRoomserverAPI{
|
rsAPI := &testRoomserverAPI{}
|
||||||
queryMissingAuthPrevEvents: func(req *api.QueryMissingAuthPrevEventsRequest) api.QueryMissingAuthPrevEventsResponse {
|
|
||||||
return api.QueryMissingAuthPrevEventsResponse{
|
|
||||||
RoomExists: true,
|
|
||||||
MissingAuthEventIDs: []string{},
|
|
||||||
MissingPrevEventIDs: []string{},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
pdus := []json.RawMessage{
|
pdus := []json.RawMessage{
|
||||||
testData[len(testData)-1], // a message event
|
testData[len(testData)-1], // a message event
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,27 +83,6 @@ type QueryStateAfterEventsResponse struct {
|
||||||
StateEvents []*gomatrixserverlib.HeaderedEvent `json:"state_events"`
|
StateEvents []*gomatrixserverlib.HeaderedEvent `json:"state_events"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type QueryMissingAuthPrevEventsRequest struct {
|
|
||||||
// The room ID to query the state in.
|
|
||||||
RoomID string `json:"room_id"`
|
|
||||||
// The list of auth events to check the existence of.
|
|
||||||
AuthEventIDs []string `json:"auth_event_ids"`
|
|
||||||
// The list of previous events to check the existence of.
|
|
||||||
PrevEventIDs []string `json:"prev_event_ids"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type QueryMissingAuthPrevEventsResponse struct {
|
|
||||||
// Does the room exist on this roomserver?
|
|
||||||
// If the room doesn't exist all other fields will be empty.
|
|
||||||
RoomExists bool `json:"room_exists"`
|
|
||||||
// The room version of the room.
|
|
||||||
RoomVersion gomatrixserverlib.RoomVersion `json:"room_version"`
|
|
||||||
// The event IDs of the auth events that we don't know locally.
|
|
||||||
MissingAuthEventIDs []string `json:"missing_auth_event_ids"`
|
|
||||||
// The event IDs of the previous events that we don't know locally.
|
|
||||||
MissingPrevEventIDs []string `json:"missing_prev_event_ids"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryEventsByIDRequest is a request to QueryEventsByID
|
// QueryEventsByIDRequest is a request to QueryEventsByID
|
||||||
type QueryEventsByIDRequest struct {
|
type QueryEventsByIDRequest struct {
|
||||||
// The event IDs to look up.
|
// The event IDs to look up.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue