Skip to content
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

Add 12 remaining 51media sytests #279

Merged
merged 11 commits into from
Apr 4, 2022
Merged

Conversation

ShadowJonathan
Copy link
Contributor

@ShadowJonathan ShadowJonathan commented Dec 26, 2021

This will add allsome remaining 51media sytests, excluding the ones ignored in #276;

./tests/51media/01unicode.pl
X Alternative server names do not cause a routing loop
  Can download specifying a different Unicode file name
  Can download with Unicode file name locally
  Can download with Unicode file name over federation
  Can upload with Unicode file name

./tests/51media/03ascii.pl
  Can download file '$filename'
  Can download specifying a different ASCII file name
  Can fetch images in room
  Can send image in room message
  Can upload with ASCII file name

./tests/51media/10thumbnail.pl
  POSTed media can be thumbnailed
  Remote media can be thumbnailed

./tests/51media/20urlpreview.pl
X Test URL preview

./tests/51media/30config.pl
  Can read configuration endpoint

Edit: Tests prefixed with X are removed after review.

This also adds a SplitMxc small helper function to client, for code dedup.

internal/data/data.go Outdated Show resolved Hide resolved
Comment on lines 82 to 84
match.JSONKeyEqual(e("matrix:image:size"), 2239.0),
match.JSONKeyEqual(e("og:image:height"), 129.0),
match.JSONKeyEqual(e("og:image:width"), 279.0),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #278, all JSON keys are returned floats, apparantly.

@ShadowJonathan ShadowJonathan changed the title Add remaining 51media sytests Add 14 remaining 51media sytests Dec 26, 2021
Copy link
Member

@kegsay kegsay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a bit of work, but overall the code is excellent. The main points:

  • Remove the tests which spin up web servers.
  • Use image/png instead of a homebrew validator.
  • Upgrade complement to 1.16 and use the embed package.

internal/validate/img.go Outdated Show resolved Hide resolved
internal/data/data.go Outdated Show resolved Hide resolved
tests/media_filename_test.go Show resolved Hide resolved
tests/media_thumbnail_test.go Outdated Show resolved Hide resolved
tests/url_preview_test.go Outdated Show resolved Hide resolved
tests/media_routing_loop_test.go Outdated Show resolved Hide resolved
@ShadowJonathan ShadowJonathan changed the title Add 14 remaining 51media sytests Add 12 remaining 51media sytests Apr 1, 2022
@ShadowJonathan ShadowJonathan requested a review from kegsay April 1, 2022 13:35
Copy link
Member

@kegsay kegsay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks amazing, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants