-
Notifications
You must be signed in to change notification settings - Fork 50
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
Sytest: Add 10apidoc/36room-levels
tests
#545
Sytest: Add 10apidoc/36room-levels
tests
#545
Conversation
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.
some of these don't seem like faithful translations — maybe that's fine, but I was a bit surprised.
However I think some checks have been dropped and I would like to see them matched or have some explanation for why they were dropped.
That said, thanks for doing this!
Would you like to open a corresponding PR in SyTest to remove the SyTests? We've been saying we should remove them at the same time and adding them to Complement, because otherwise the SyTest gets updated and they fall out of sync and need translating again. Also, no sense testing things twice...
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.
minor points, other than that I think we should have the SyTest PR lined up to remove the SyTest before merging this
// note: before v10 we technically cannot assume that powerlevel integers are json numbers, | ||
// as they can be both strings and numbers. | ||
// However, for this test, we control the test environment, | ||
// and we will assume the server is sane and give us powerlevels as numbers, | ||
// and if it doesn't, that's an offense worthy of a frown. |
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.
meh, I think anyone would be happy to agree that a server that creates stringy power levels itself (not just accepting them from a client) should be treated as non-compliant.
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.
(or put another way: Complement should not be afraid to test 'good practices' that go a little bit above and beyond the bare minimum in the spec, as long as there's no good reason why a homeserver implementer would do the opposite. In this case, I can't think of any valid reason why a homeserver should produce string power levels on its own.)
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.
Technically a server would not be in the wrong to create non-integer power levels, buuuut... I agree, I think it'd brush up against the edge of reasonable behaviour.
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.
Considering there'd be no reason for it to do so and it's only 'allowed' for compatibility, I really can't see any way to defend allowing a server doing this by default in a clean test environment such as Complement.
This adds three sytests:
./tests/10apidoc/36room-levels.pl:test "GET /rooms/:room_id/state/m.room.power_levels can fetch levels",
./tests/10apidoc/36room-levels.pl:test "PUT /rooms/:room_id/state/m.room.power_levels can set levels",
./tests/10apidoc/36room-levels.pl:test "PUT power_levels should not explode if the old power levels were empty",
This skips a test called "Both GET and PUT work" because its sole existence in sytest appears to be to prove the ability to set and get powerlevels, for other test's requirements.