Commit Graph

59 Commits

Author SHA1 Message Date
Tom Longhurst
cd1835326b Fix xUnit Warnings (#2906)
* Fix xUnit Warnings

* Fix

* Fix formatting in AsyncPaginationExtensionGenerator.cs

---------

Co-authored-by: Keegan Campbell <me@kfcampbell.com>
2024-04-15 13:19:26 -07:00
Martin Costello
4f826bc65b [fix] Fix handling for Streams in IConnection for raw content (#2791)
* Fix handling for Streams

Fix `NullReferenceException` if raw content was handled as a string rather than a stream by `HttpClientAdapter.BuildResponse()`.
Resolves #2789.

* Add Connection.GetRaw tests

Add tests for `Connection.GetRaw()` and for #2789.

---------

Co-authored-by: Keegan Campbell <me@kfcampbell.com>
2023-11-06 16:47:30 -08:00
Yankai
66587ee0d1 [feat] Add Response caching 2023-02-07 11:35:54 -06:00
Tim Rogers
3d6cdc459f [MAINT] Tweak User-Agent to refer to Octokit.net, not just Octokit (#2447) 2022-07-11 09:04:44 -05:00
Chris Simpson
b023602347 [FEAT] Adding in handling for secondary rate limit exceptions (#2473) 2022-07-11 09:03:31 -05:00
Brendan Forster
287861e4a7 rewrite the setup of responses to use a standard helper function (#2177) 2020-04-14 11:30:15 -03:00
Brendan Forster
327020750f add convention test for preview APIs (#2154) 2020-03-18 08:52:50 -03:00
Brendan Forster
eb65e090ca next batch of test cleanup (#2004) 2019-09-20 10:41:04 -03:00
Sean Killeen
01a2d97212 Update ApiErrorMessageSafe to return null for empty and whitespace strings (#1540)
* return null if ApiError.Message is empty or whitespace

* Uncomment test, which now passes
2017-01-16 23:13:00 +10:00
Sean Killeen
4cec3a6532 Introduce AbuseException (#1528)
* Add some tests to be completed

* Actually fail the tests

* Create AbuseException class

Copied from ForbiddenException and then gone over to inherit from it.

* Actually add AbuseException to csproj

* Update test file

* Ran .\build FixProjects

* Test updates

* Default message update for AbuseException

* Separate the exception creation logic

* Remove message assertion -- doesn't matter here

* Additional test for abuse message

* Remove unnecessary variable assignment

* Failing test for unsafe request

* Attempt to fix test

Still broken -- I don't think empty strings count to trigger the default
message

* Remove test that will always fail due to another issue

Opened #1529 to explore this.

* New tests (some failing)

* Passing tests are, like, better than failing tests.

* Last passing test

* Cleanup

* Add test for zero value and fix code

Lol boundary cases.

* cleanup

* Mark ParseRetryAfterSeconds as static

* Add GetObjectData override to AbuseException

To include data for RetryAfterSeconds variable, and satisfy the build
check.

* Add back failing test & skip it

* Change to nullable int with null default

* Fix tests around nullable default

* whitespace fixes

* Compact the logic; tests still pass

* Invert the if statements for compactness / clarity

* Test subclasses & reformatting

* Test name changes

* Whitespace fix

* Remove redundant line
2017-01-12 07:30:43 +10:00
aedampir@gmail.com
fc644a0b1d ConnectionTests fixes 2016-03-29 17:38:39 +07:00
aedampir@gmail.com
7f5d446ea8 Redundant commas in object initializers were removed. 2016-03-24 23:12:12 +07:00
Devesh Khandelwal
534d54bb7f Verify Serialize is getting called with correct params. 2016-03-09 11:25:07 +05:30
Devesh Khandelwal
6e49068c8d Serialize object using mock serializer. Courtesy of @M-Zuber. 2016-03-08 14:59:46 +05:30
Brendan Forster
51e56a86d7 some rogue Console.WriteLine in tests 2015-12-20 14:09:30 +10:30
Brendan Forster
80719c0033 aaaand format the code 2015-11-04 13:38:51 -08:00
Mark Taylor
b2c7e1c2a7 Chnage LastApiInfo to GetLastApiInfo with cloned version 2015-08-16 21:27:26 +01:00
Mark Taylor
40f1e59a97 Fixed merge conflicts 2015-08-02 16:40:10 +01:00
David Alpert
b4d71c8fe9 refactoring ApiConnection.EmptyBody to RequestBody.Empty to break the inverse dependency from Connection to ApiConnection 2015-08-01 00:16:51 -05:00
David Alpert
c54dfa196f adding passing tests: ConnectionTests.ThePutMethod can submit PUT requests with no data (i.e. empty body). 2015-07-31 23:49:48 -05:00
David Alpert
ef8a6fe2cc refactoring ThePutMethod tests to clearly use the same body throughout 2015-07-31 23:47:48 -05:00
Kristian Hellang
bc5a14a8af Fixed failing tests 2015-07-31 12:23:13 +02:00
Mark Taylor
f8ee4f94a1 WIP checkin for getting last ApiInfo object 2015-07-31 10:35:51 +01:00
Brendan Forster
3859ff3627 the test, it passes 2015-05-31 22:12:22 +09:30
Mordechai Zuber
347da7b938 ApiConnection, Connection 2015-05-19 09:28:52 +03:00
Brendan Forster
c595f26515 unshipping preview API changes due to excessive paging introduced in some situations 2015-03-01 20:04:35 +09:30
joshvera
fbe204c58f fix tests 2015-02-23 09:25:17 +09:30
Haacked
6c05651d64 Remove the redundant ApiInfo property 2015-01-04 19:15:44 -08:00
Haacked
4653e798a7 Make Response.StatusCode readonly 2015-01-04 19:15:42 -08:00
Haacked
89e8fdfeaf Make Response.Body readonly 2015-01-04 19:15:40 -08:00
Haacked
c2d51570fd Make IResponse.Headers a readonly dictionary 2015-01-04 19:13:35 -08:00
Haacked
ff3506f3e8 Make some of the IResponse properties readonly 2015-01-04 19:13:32 -08:00
Haacked
4c8bab20eb IApiResponse no longer inherits IResponse 2015-01-04 18:58:53 -08:00
Haacked
49f95d40f1 Remove Type parameter for IHttpClient send method
This keeps the IHttpClient interface simpler and ensures the
deserialization responsibility lies outside of that class. It only
needed the Type parameter for a special case that could be handled in a
better way.
2015-01-04 18:22:05 -08:00
Paul Betts
a38df58035 Fix up test class names 2014-04-30 21:34:07 -07:00
Paul Betts
1c8ac1d32a Fix up ApiExtensions 2014-04-30 21:31:52 -07:00
Paul Betts
c18b156fab Rename IConnection methods 2014-04-30 21:30:45 -07:00
Nigel Sampson
2b470ed5dc Unit tests accepts overrides 2014-04-08 10:46:32 +12:00
Brendan Forster
c3cf8d1cca updated tests to use correct mock 2014-02-18 11:13:28 +11:00
Haacked
e9602a3dad Fix base address to end with slash 2013-10-29 16:51:45 -07:00
Haacked
1d64210ac5 Fix endpoint URLs for Enterprise support
Since Enterprise base URLs end with /api/v3 we need to make sure
the endpoints are relative and not absolute.
2013-10-29 16:02:00 -07:00
Haacked
6b7a6b7137 Build user agent from user supplied product info
Rather than create a default user agent, we'll build the user agent for
the user of the library. We only require that the user provide us
product information.

fixes #61
2013-10-28 11:20:38 -07:00
Haacked
70b94187b3 Add NotFoundException for 404 status 2013-10-23 14:46:59 -07:00
Haacked
a1887837be Implement 403 exception handling
This implements exception handling for the various 403 cases based off
of the Octokit.rb implementation.
https://github.com/octokit/octokit.rb/blob/master/lib/octokit/error.rb

Fixes #85
2013-10-17 22:22:56 -07:00
Haacked
995e0c5b55 More api cleanup
Make accepts come before contentType everywhere. Also remove unnecessary
overloads of IConnection.
2013-10-15 15:43:52 -07:00
Haacked
c839c33b5a Fix up tests 2013-10-15 14:17:19 -07:00
Haacked
d6e560c737 Remove type argument from DeleteAsync 2013-10-15 13:43:16 -07:00
Haacked
2168d92e8f Fix bug with Put setting invalid content type
Turns out we were calling the wrong overload.
2013-10-15 10:18:17 -07:00
Haacked
33ad79c0fe Implement GetOrCreateApplicationAuthentication
Implements the endpoint for creating an application authorization token.
2013-10-09 19:54:05 -07:00
half-ogre
6f3fa81789 move internal stuff to .Internal namespace 2013-10-08 15:14:06 -07:00