-
Notifications
You must be signed in to change notification settings - Fork 0
chore: Complement tests for MSC3911 #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fe34c11 to
4578690
Compare
07b8df1 to
c7e7dd2
Compare
c7e7dd2 to
d473269
Compare
|
Do we need to add msc3911 package to |
No, I don't think so. Those packages were chosen to represent a bare minimum of support. This particular test run just makes sure we haven't broken anything for the internals of Complement itself if/when we change something. The actual line up of tests is decided on that repo/platform that runs it in it's own CI(like I added in famedly/synapse#139) |
client/client.go
Outdated
|
|
||
| // UncheckedDownloadContentAuthenticated makes the raw request for a piece of media and returns the http.Response. | ||
| // Response is unchecked in any way. The existing DownloadContentAuthenticated() should have been a "Must" variant. Rather | ||
| // than refactor that across the code base, this version just uses an explict name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a little typo explict -> explicit
|
|
||
| // MustSetDisplayName sets the global display name for this account or fails the test. | ||
| func (c *CSAPI) MustSetProfileAvatar(t ct.TestLike, mxcUri string) { | ||
| c.MustDo(t, "PUT", []string{"_matrix", "client", "v3", "profile", c.UserID, "avatar_url"}, WithJSONBody(t, map[string]any{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be better to also add t.Helper() here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 Probably, nice catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I missed it since the display setter just above did not have it. Looks like the display name "getter" below doesn't either. I wonder just how significant it really it. I think it's just to make the logging simpler in it's display and otherwise has no functional use. Oh well, putting it in anyways
| // We will reuse that and copy it | ||
|
|
||
| // There seem to be no existing utilities to split an mxc uri into it's components, which is needed for the copy endpoint. | ||
| // Mxc uri's are formatted as "mxc://server_name/media_id" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is the func SplitMxc(mxcUri string) (string, string) in client.go, maybe we can reuse it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch, not sure how I missed that
| if !bytes.Equal(aliceOriginalProfileBytes, aliceNewAvatarBytes) { | ||
| t.Fatalf("Media is differing and should be identical") | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add that the newMxcUri is not equal to the aliceGlobalProfileAvatarMxcUri?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comparison test also, good idea.
|
Looks good 👍 I didn't expected that the |
🎉
It's not supposed to be. I believe it's actually a Synapse bug, and appears to be part of the "peeking" capability for seeing into a room in advance. I actually have the test scenario written up, thanks for reminding me about that.
🤔 I don't know. It shouldn't, as there is a priority indexing structure that we use in Synapse that places bans below leaves. It should just work, but let me stare at this a while and see if I can produce a test for that. |
So, to properly test this, would have to basically duplicate(or at least add to) each existing test. Do we want this? Just like with "bob", either is invited to or joins a room, just to get banned and then test ability to see the media. I want to say it comes across the same as a "leave", but am open to suggestion EDIT: It also looks like it would end up depending on exactly when we ban the user(before or after the media is available). Because we check to see if they were ever able to actually see the media, if they ever could they should still be able to even after a ban |
hmm. Banned user still able to see the media doesn't sound right. Should we maybe remove the copied media for banned user? |
I'm not sure. I don't think so. A ban is just a "forced" leave event on a room. I think they still have the right to see the past of when they were in there. Consider the case of a malicious ban from a room that was for not a legitimate reason. Would you like to be able to go back and collect that evidence to make an appeal? |
itsoyou
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I heard yesterday standup that according to the spec, banned user is still able to see the past events when the person was still in the room. All good 👍
Adjust TestAvatarUrlUpdate to make MXC's match the matrix spec
7b65328 to
4cbce73
Compare
MSC3911 Testing for Complement
For: https://github.com/famedly/product-management/issues/3367
Testing(both local and federated):
Adjusted existing test:
Depends on #4