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 tests using testdata input files #251

Closed
9 tasks done
atc0005 opened this issue Mar 28, 2024 · 3 comments · Fixed by #310
Closed
9 tasks done

Add tests using testdata input files #251

atc0005 opened this issue Mar 28, 2024 · 3 comments · Fixed by #310
Assignees
Labels
enhancement New feature or request tests
Milestone

Comments

@atc0005
Copy link
Owner

atc0005 commented Mar 28, 2024

Proposed input files:

  • single non-Safe Links URL
  • single Safe Links URL
  • list of Safe Links URLs
  • mix of URLs
    • https:// with url query parameter (expected Safe Links URL pattern)
    • http:// with url query parameter (invalid Safe Links URL pattern)
    • http:// without url query parameter (invalid Safe Links URL pattern)
    • https:// without url query parameter (invalid Safe Links URL pattern)
  • email text with embedded Safe Links URLs with enclosing angle brackets
  • email text with embedded Safe Links URLs without enclosing angle brackets
  • email text with embedded URLs (no Safe Links URLs) without enclosing angle brackets
  • email text with embedded URLs (no Safe Links URLs) containing enclosing angle brackets
  • email text with mix of embedded URLs (Safe Links URLs and non-Safe Links URLs) with some URLs enclosed in angle brackets
@atc0005 atc0005 added enhancement New feature or request tests labels Mar 28, 2024
@atc0005 atc0005 added this to the Future milestone Mar 28, 2024
@atc0005 atc0005 self-assigned this Mar 28, 2024
atc0005 added a commit that referenced this issue Mar 31, 2024
Some of the upcoming testdata files will have intentional
line endings set per file and we do not want git's automatic
conversion feature to (potentially, based on client settings)
interfere with explicitly chosen EOLs.

refs GH-251
atc0005 added a commit that referenced this issue Mar 31, 2024
Some of the upcoming testdata files will have intentional
line endings set per file and we do not want git's automatic
conversion feature to (potentially, based on client settings)
interfere with explicitly chosen EOLs.

refs GH-251
@atc0005 atc0005 modified the milestones: Future, v0.5.0 Apr 7, 2024
atc0005 added a commit that referenced this issue Apr 7, 2024
- add collection of testdata files
  - `input`
    - `encoded-all`
    - `encoded-mixed`
    - `invalid-all`
    - `invalid-mixed`
  - `output`
    - `embedded`
    - `standalone`
- add "exported" tests which focus strictly on exported functionality
  of the `internal/safelinks` package
- add minor dependency on the `google/go-cmp` package for some tests
- add brief README for testdata content to explain purpose, important
  of preserving the exact formatting (mostly specific EOL) within the
  input and output testdata files

refs GH-251
atc0005 added a commit that referenced this issue Apr 7, 2024
- add collection of testdata files
  - `input`
    - `encoded-all`
    - `encoded-mixed`
    - `invalid-all`
    - `invalid-mixed`
  - `output`
    - `embedded`
    - `standalone`
- add "exported" tests which focus strictly on exported functionality
  of the `internal/safelinks` package
- add minor dependency on the `google/go-cmp` package for some tests
- add brief README for testdata content to explain purpose, important
  of preserving the exact formatting (mostly specific EOL) within the
  input and output testdata files

refs GH-251
@atc0005
Copy link
Owner Author

atc0005 commented Apr 7, 2024

  • mix of URLs
    • https:// with url query parameter (expected Safe Links URL pattern)
    • http:// with url query parameter (invalid Safe Links URL pattern)
    • http:// without url query parameter (invalid Safe Links URL pattern)
    • https:// without url query parameter (invalid Safe Links URL pattern)

GH-291 adds most of the testdata cases noted in the OP but input URLs with a url query parameter are not present as of this writing.

atc0005 added a commit that referenced this issue Apr 7, 2024
- add collection of testdata files
  - `input`
    - `encoded-all`
    - `encoded-mixed`
    - `invalid-all`
    - `invalid-mixed`
  - `output`
    - `embedded`
    - `standalone`
- add "exported" tests which focus strictly on exported functionality
  of the `internal/safelinks` package
- add minor dependency on the `google/go-cmp` package for some tests
- add brief README for testdata content to explain purpose, important
  of preserving the exact formatting (mostly specific EOL) within the
  input and output testdata files

refs GH-251
atc0005 added a commit that referenced this issue Apr 7, 2024
- add collection of testdata files
  - `input`
    - `encoded-all`
    - `encoded-mixed`
    - `invalid-all`
    - `invalid-mixed`
  - `output`
    - `embedded`
    - `standalone`
- add "exported" tests which focus strictly on exported functionality
  of the `internal/safelinks` package
- add minor dependency on the `google/go-cmp` package for some tests
- add brief README for testdata content to explain purpose, important
  of preserving the exact formatting (mostly specific EOL) within the
  input and output testdata files

refs GH-251
atc0005 added a commit that referenced this issue Apr 7, 2024
- add collection of testdata files
  - `input`
    - `encoded-all`
    - `encoded-mixed`
    - `invalid-all`
    - `invalid-mixed`
  - `output`
    - `embedded`
    - `standalone`
- add "exported" tests which focus strictly on exported functionality
  of the `internal/safelinks` package
- add minor dependency on the `google/go-cmp` package for some tests
- add brief README for testdata content to explain purpose, important
  of preserving the exact formatting (mostly specific EOL) within the
  input and output testdata files

refs GH-251
atc0005 added a commit that referenced this issue Apr 7, 2024
- add collection of testdata files
  - `input`
    - `encoded-all`
    - `encoded-mixed`
    - `invalid-all`
    - `invalid-mixed`
  - `output`
    - `embedded`
    - `standalone`
- add "exported" tests which focus strictly on exported functionality
  of the `internal/safelinks` package
- add minor dependency on the `google/go-cmp` package for some tests
- add brief README for testdata content to explain purpose, important
  of preserving the exact formatting (mostly specific EOL) within the
  input and output testdata files

refs GH-251
atc0005 added a commit that referenced this issue Apr 7, 2024
I previously tried to simplify logic to avoid this func being
flagged by gocognit but botched the error handling logic.

Fix logic and ignore gocognit warnings for the exported_test.go
file.

refs GH-251
atc0005 added a commit that referenced this issue Apr 7, 2024
I previously tried to simplify logic to avoid this func being
flagged by gocognit but botched the error handling logic.

Fix logic and ignore gocognit warnings for the exported_test.go
file.

refs GH-251
atc0005 added a commit that referenced this issue Apr 7, 2024
Help ensure that recent changes to require known safelinks "base"
domain to be present in Safe Links URLs continutes to function
as intended.

Previously, these input URLs would have been incorrectly flagged
as Safe Links URLs and "decoded" into the value of the `url`
query parameter.

refs GH-251
@atc0005
Copy link
Owner Author

atc0005 commented Apr 7, 2024

  • mix of URLs
    • https:// with url query parameter (expected Safe Links URL pattern)
    • http:// with url query parameter (invalid Safe Links URL pattern)
    • http:// without url query parameter (invalid Safe Links URL pattern)
    • https:// without url query parameter (invalid Safe Links URL pattern)

GH-294 completes this list of requirements.

atc0005 added a commit that referenced this issue Apr 8, 2024
Extend coverage for URLs without and without angle brackets.
This is less important for the GUI app (which is already
tested against this scenario) but should help with
future CLI app support for angle bracket enclosed input.

refs GH-251
atc0005 added a commit that referenced this issue Apr 8, 2024
Extend coverage for URLs with and without angle brackets.
This is less important for the GUI app (which is already
tested against this scenario) but should help with
future CLI app support for angle bracket enclosed input.

refs GH-251
atc0005 added a commit that referenced this issue Apr 10, 2024
- add collection of testdata files
  - `input`
    - `encoded-all`
    - `encoded-mixed`
    - `invalid-all`
    - `invalid-mixed`
  - `output`
    - `embedded`
    - `standalone`
- add "exported" tests which focus strictly on exported functionality
  of the `internal/safelinks` package
- add minor dependency on the `google/go-cmp` package for some tests
- add brief README for testdata content to explain purpose,
  importantance of preserving the exact formatting (mostly specific
  EOL) within the input and output testdata files

Add new testdata URLs with a url parameter

Help ensure that recent changes to require known safelinks "base"
domain to be present in Safe Links URLs continutes to function
as intended.

Previously, these input URLs would have been incorrectly flagged
as Safe Links URLs and "decoded" into the value of the `url`
query parameter.

refs GH-251
atc0005 added a commit that referenced this issue Jul 16, 2024
Extend coverage for URLs with and without angle brackets.
This is less important for the GUI app (which is already
tested against this scenario) but should help with
future CLI app support for angle bracket enclosed input.

refs GH-251
@atc0005
Copy link
Owner Author

atc0005 commented Jul 16, 2024

The changes from GH-296 (dev branch) were missed when preparing GH-310 (stable branch).

Handling that via GH-449 now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request tests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant