Commit graph

45 commits

Author SHA1 Message Date
Babak K. Shandiz
284880c21e
Fix StatusJSONResponse usage (#10810)
* Fix `StatusJSONResponse` usage

Signed-off-by: Babak K. Shandiz <babakks@github.com>

* Replace `assert` with `require`

Signed-off-by: Babak K. Shandiz <babakks@github.com>

* Improve assertion against errors

Signed-off-by: Babak K. Shandiz <babakks@github.com>

* Add `JSONErrorResponse` helper func

Signed-off-by: Babak K. Shandiz <babakks@github.com>

* Use `httpmock.JSONErrorResponse`

Signed-off-by: Babak K. Shandiz <babakks@github.com>

* Replace `StatusJSONResponse` to `JSONErrorResponse` for better readibility

Signed-off-by: Babak K. Shandiz <babakks@github.com>

* Fix improper use of `StatsJSONResponse`

Signed-off-by: Babak K. Shandiz <babakks@github.com>

---------

Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-05-01 20:22:43 +01:00
Michael Hoffman
8e2be7326b Improve http error test cases 2025-02-07 16:51:19 -05:00
Michael Hoffman
9eaaf44516 Handle non-TTY behavior 2025-02-07 16:27:04 -05:00
Michael Hoffman
d5adafd3fb Rename staggler 2025-02-02 21:46:56 -05:00
Michael Hoffman
a1ae68b4f4 Formatting 2025-02-02 21:37:34 -05:00
Michael Hoffman
021557912d AuoLink -> Autolink 2025-02-02 21:34:03 -05:00
Michael Hoffman
0b3efede35 Use http constants 2025-02-02 21:12:49 -05:00
Michael Hoffman
f907ad9f97 refac and some spacing in output 2025-02-02 20:50:37 -05:00
Michael Hoffman
7325944040 More consistency 2025-02-02 20:31:12 -05:00
Michael Hoffman
0274999880 whitespace 2025-02-02 20:22:51 -05:00
Michael Hoffman
dcc1efa2bd clean up 2025-02-02 20:22:16 -05:00
Michael Hoffman
fc5a6d1c3f Autolink delete http tests 2025-02-02 20:09:49 -05:00
Michael Hoffman
e226a79dc5 Autolink delete tests 2025-02-01 15:46:09 -05:00
Michael Hoffman
908513f97f Initial working implementation 2025-02-01 11:09:00 -05:00
Michael Hoffman
b23cf6e8d7 Update formatting for autolink output 2025-01-29 16:24:47 -05:00
Michael Hoffman
e4d720ba22 Remove redundant error check 2025-01-29 11:12:28 -05:00
Andy Feller
fe21e10ae8 Keeping autolink IDs the same in all test cases 2025-01-29 10:16:02 -05:00
Andy Feller
af538b277d Expand test case
- add autolink view case for numeric
- simplifying local variable usage
2025-01-29 10:10:42 -05:00
Michael Hoffman
21a5267be4 Remove unused test field 2025-01-29 09:35:05 -05:00
Michael Hoffman
8b7d6d1b3f Remove unused test field 2025-01-29 09:34:29 -05:00
Michael Hoffman
8f55dbcf61 Error case test for viewRun 2025-01-28 14:07:48 -05:00
Michael Hoffman
32ee4db484 Autolink view HTTP tests 2025-01-28 13:33:50 -05:00
Michael Hoffman
58d84a4088 Shorten description 2025-01-28 12:03:03 -05:00
Michael Hoffman
11ce0c661c Updates following renaming domain to shared 2025-01-28 11:43:57 -05:00
Michael Hoffman
f941608091 Partial testing for view 2025-01-28 11:43:57 -05:00
Michael Hoffman
e8475d9fb8 Initial, working implementation 2025-01-28 11:43:57 -05:00
Andy Feller
7c31d1a76b Minor refactoring autolink create help and logic
- simplified and wrapped `gh repo autolink create` and `gh repo autolink` long help usage docs
- simplified success message, brought into alignment with other commands
2025-01-27 17:47:55 -05:00
Michael Hoffman
e916ae5b43 Rename domain pkg to shared 2025-01-13 09:08:19 -05:00
Michael Hoffman
fdf9a6e2f6 Fix typos 2025-01-05 19:41:15 -05:00
Michael Hoffman
6cf2e9ee3e feat: Add support for creating autolink references 2025-01-05 15:37:17 -05:00
Michael Hoffman
a5cf3751cd Separate type decrarations 2025-01-02 13:14:23 -05:00
Michael Hoffman
fa254ba205 Complete get -> list renaming 2024-12-28 07:51:47 -05:00
Michael Hoffman
da826db342 Better error testing for autolink TestListRun 2024-12-27 22:58:12 -05:00
Michael Hoffman
20f086549a Decode instead of unmarshal 2024-12-27 22:03:25 -05:00
Michael Hoffman
63488a1a06 Use 'list' instead of 'get' for autolink list type and method 2024-12-27 22:02:19 -05:00
Michael Hoffman
dc6320f7f7 Remove NewAutolinkClient 2024-12-27 21:47:27 -05:00
Michael Hoffman
cc24289832 Break out autolink list json fields test 2024-12-27 21:43:47 -05:00
Michael Hoffman
67266e9cb8 PR nits 2024-12-27 21:40:52 -05:00
Michael Hoffman
e98ff2ea38 Refactor autolink subcommands into their own packages 2024-12-27 21:36:16 -05:00
Michael Hoffman
ea04d2da30 Whitespace 2024-12-27 21:36:16 -05:00
Michael Hoffman
869d25193a Refactor out early return in test code
Co-authored-by: Tyler McGoffin <jtmcg@github.com>
2024-12-27 21:36:16 -05:00
Tyler McGoffin
4a74cc8856 Add testing for AutoLinkGetter
This adds the missing mocked http tests to the http_test.go file. These
tests were previously bundled with the tests in list_test.go, creating a
testing pattern that was difficult to understand and maintain. The
refactor in the previous commit replaced these tests with the
AutolinkClient interface, allowing for the httpmocks to be isolated to the
AutolinkGetter that implements that interface.
2024-12-27 21:36:16 -05:00
Tyler McGoffin
a390ce4f10 Refactor autolink list and test to use http interface for simpler testing
This defines an AutolinkClient interface with a Get method used for
fetching the autolinks lists from the api. Then, the http client for
autolinks implements this interface with the AutolinkGetter struct.

This allows for dependency injection of the AutolinkGetter struct into the
listOptions, enabling mocking of the AutolinkGetter for testing. The
result of this is simpler tests that are easier to maintain, because the
interface for the table tests now allow for defining autolink structs as
the response instead of large mocked api calls.

This also allows for bespoke testing of the http file, which I'll follow
up with in the next commit.
2024-12-27 21:36:16 -05:00
Tyler McGoffin
5fb98524e0 Apply PR comment changes 2024-12-27 21:36:16 -05:00
Michael Hoffman
23c16c9c4c Introduce repo autolinks list commands 2024-12-27 21:36:16 -05:00