Commit Graph

23 Commits

Author SHA1 Message Date
Ryan Gribble cf442499ff add RequiredApprovingReview preview functionality to branch protection calls (#1912) 2019-01-30 21:20:50 +10:00
tasadar2 3345f76fc9 Adding a convention test to detect whether a model has a constructor exposing all properties (#1798)
* Added a convention test to detect a model constructor exposing all properties

* add ctors to classes where they are missing

* rename ctor parameters that dont match properties

* add missing parameters to existing ctors

* add specific PunchCard ctor to allow mocking, and update test to resolve call ambiguity

* Added base class properties to the convention test

Added member exclusion attribute

* Updated newly offending classes

2 excludes and 2 ctors

* rename exclusion attribute to be a bit shorter
2018-04-25 21:03:13 +10:00
Ryan Gribble f9ffce822b Provide constructors for EnforceAdmins class to allow mocking (#1679) 2017-09-12 13:15:44 +10:00
Mordechai Zuber a2b48a66a4 ProtectedBranches API changes for Required Review Enforcement (#1523)
* Add `BranchProtectionRequiredPullRequestReviews` and `BranchProtectionRequiredPullRequestReviewsUpdate` models

* Add missing ctors and fix naming

Tests where updated to use the minimum nesseccary constructor

* Fix debugger display

* Update BranchProtection response model to include new dismissal restrictions fields and tidy up existing properties ctors and DebuggerDisplay

* Update BranchProtectionUpdate request model to include new dismissal restrictions fields/classes and tidy up existing properties and DebuggerDisplay

* Update BranchProtection tests to use new RequiredReviews and dismissal restrictions options

* Add specific client endpoints for GetReviewEnforcement UpdateReviewEnforcement and RemoveReviewEnforcement

* Add unit and integration tests for new client methods

* Implement Observable client methods and unit tests

* Add integration tests for Observable client

* Run CodeFormatter to fix up whitespace

* Clarify review dismissal restriction behaviour in code comments
2017-08-30 21:12:42 +10:00
Ryan Gribble 98dfd77142 Remove the obsolete branch protection methods and classes as they are now no longer supported (#1620) 2017-06-26 22:10:17 +10:00
Kristian Hellang 5ee4d64046 Add StringEnum to handle unknown enum values returned from API (#1595)
* Added StringEnum<TEnum>

* Added tests

* Make sure the serializer can work with StringEnum

* Use StringEnum for EventInfo.Event

* Add convention test to assert that all Response models use StringEnum<> to wrap enum properties

* Add Stringnum<> to all response types failing convention test

* Handle StringEnum to Enum conversion when Issue response model populates IssueUpdate request model

* Fix unit test

* Refactor SimpleJsonSerializer to expose the DeserializeEnum strategy so it can be used in StringEnum class

* Need to expose/use SerializeEnum functionality too, so we use the correct string representation of enum values that have custom properties (eg ReactionType Plus1 to "+1")

* fix unit tests, since the string is now the "correct" upstream api value

* Add a couple of tests for the Enum serialize/deserialize when underscores, hyphens and custom property attributes are present

* Compare parsed values for equality

* add convention test to ensure enum members all have Parameter property set

* update test to cover implicit conversions too

* this test should work but fails at the moment due to magic hyphen removal in deserializer causing a one way trip from utf-8 to EncodingType.Utf8 with no way to get back

* (unsuccesfully) expand event info test to try to catch more cases of unknown event types

* fix broken integration test while im here

* Fixed build errors after .NET Core merge

* Value -> StringValue, ParsedValue -> Value

* Don't allow StringValue to be null

* Ignore enums not used in request/response models

* Added ParameterAttribute to almost all enum values

* Ignore Language enum

* Fix failing tests

* Fix milestone sort parameter and tests

* whitespace

* fix milestone unit tests

* Fix StringEnum.Equals ... This could've been embarrassing!

* Change SimpleJsonSerializer Enum handling to only use `[Parameter()]` attributes (no more magic removal of hyphen/underscores from strings)

* Tidy up this integration test while im here

* Only test request/response enums in convention test

* Keep skipping Language

* Remove unused method

* Remove excluded enum types

* Removed unnecessary ParameterAttributes

* Remove unused enum

* Add StringEnum test for string-comparison of two invalid values

* Bring back IssueCommentSort and use it in IssueCommentRequest

This reverts commit 38a4a291d1476ef8c992fe0f76956974b6f32a49.

* Use assembly instead of namespace for Octokit check

* Add failing test to reproduce the issue where only the first enum paramter/value was added to the cache

* Fix deserializer enum cache to include all enum members rather than only the first member encountered

* Use a static SimpleJsonSerializer in StringEnum

* Remove serializer instance in StringEnum

* Add some documentation on StringEnum<TEnum>

* Fix parameter value to resolve failing integration test
2017-06-25 19:29:57 +10:00
Mordechai Zuber 58ba2eccf9 Add BranchProtection.EnforceAdmins object (#1598)
* Add BranchProtection.EnforceAdmins object

* Add EnforceAdmin related methods to RepoBranch clients

* Add unit tests

* Add unit tests for Observable client

* Add integration tests for enforce admin methods

* Tweak integration test to ensure that they actually do something

The `CreateRepositoryWithProtectedBranch` helper method currently sets `EnforceAdmins` as true, so delete it before adding.

* add missing docs

* rename tests

* Add missing ctor

* Remove property that is no longer supported

https://developer.github.com/changes/2017-05-02-adoption-of-admin-enforced/

* Fix failing unit tests
2017-05-04 22:34:58 +10:00
Ryan Gribble 3c818934b8 Release v0.24 - A Sight For Sore Eyes (#1539)
* Add release notes and bump version to 0.24

* run "build FormatCode" to fix up whitespace/formatting issues

* Fix failing Ssh key tests due to "validation exception".  This key must be in use on github (under another user, most likely from these tests failing).  Changed to a new SSH key and tweaked tests to reduce chance of a key being created and not destroyed

* Assignee and Assignees cant both be specified on NewIssue.  We missed this one in the PR.  Marked Assignee as [Obsolete] and fixed tests to use Assignees

* Fix a couple of Reactions tests that were calling the wrong client methods

* Fix timeline tests - looks like the response class has changed shape a bit, it now has an Issue object in the payload and Id field isnt present (leaving Id field there in case other timeline events do use it)

* Fix some following tests that require the test user to follow more than 1 other user

* Unskip these Event tests now because apparently they work!

* add breaking changes notes

* 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

* update release notes to include PR1540

* Add "Bot" AccountType, was causing a deserialization exception when running the integration test "SearchForExcludedLanguage" (#1541)

* Update to include PR1541

* add bullets to make release notes easier to read

* markup additional code mentions in notes

* Fix grammar

fields => field
2017-01-17 18:56:55 +10:00
Ryan Gribble e6bf4635e9 rework obsolete warnings to collect a few places previuosly missed and reword to direct users to the new equivalent branch protection methods 2016-08-30 20:43:01 +10:00
Ryan Gribble 0334730126 Fixup string.Format casing for consistency 2016-08-26 07:34:43 +10:00
Ryan Gribble 902a5d765f Tweak naming of classes to be consistent
Change team and user lists to specific classes derived from Collection<T> so we can offer better configuration of BranchProtectionPushRestriction via multiple ctors (teams only, users only, teams and users, etc)
Add another ctor to BranchProtectionPushRestrictions for the case where no teams/users are specified (ie admin only)
Change organization update tests to use this new ctor and assert we get empty lists rather than no push restrictions
2016-08-26 07:19:57 +10:00
Ryan Gribble c96ee7ac01 Move comment to <remarks> section 2016-08-15 21:13:53 +10:00
Ryan Gribble 6ebf1939b6 tweak comments 2016-08-10 21:17:52 +10:00
Ryan Gribble 51e2380d70 debug implementation while writing integration tests
- fix Update method PUT parameters
- add [SerializeNull] to various request fields
- fix deserialize problem with ProtectedBranchRestrictions ctor not being public
- tidy up DebuggerDisplay output
2016-08-10 14:23:48 +10:00
Ryan Gribble 3bd7323044 Add comments, move request classes to new file 2016-08-08 23:25:52 +10:00
Ryan Gribble 466d0763d2 First cut at adding Get/Update/Delete methods for branch protection
So far only non reactive client and unit tests
2016-08-08 22:09:12 +10:00
Ryan Gribble ba127b21a8 Mark existing BranchProtection classes/properties and RepositoriesClient.EditBranch() method obsolete, due to breaking changes in the API preview period 2016-07-22 07:22:29 +10:00
aedampir@gmail.com 211cfb0036 BranchProtection fixes 2016-03-29 17:42:33 +07:00
Ryan Gribble 7be9dc0838 Make Contexts IReadonlyList implemented as per CommitActivity
Tidy up to be consistent with other model classes
2015-12-19 19:58:13 +10:00
Ryan Gribble 87bb4669e4 Remove AddContext() and ClearContexts() in favour of just using the List passed into the ctor 2015-12-19 19:58:10 +10:00
Ryan Gribble 6b8312276f Response objects need protected setters and ctors with parameters
Rework integration test examples
2015-12-19 19:58:09 +10:00
Ryan Gribble ef8270614f Add DebuggerDisplay property to model classes 2015-12-19 19:58:02 +10:00
Ryan Gribble 2a2a4b6d22 Add Protected Branches to Branch object
- Create BranchProtection models
- Add Protection element to Branch model
- Adjust RepositoryClient GetBranch and GetBranches calls to set the special preview accepts header to enable Protected Branches API (currently in preview)
- Adjust tests to include preview accepts header
- Add test for Protection element
2015-12-19 19:58:00 +10:00