@@ -28,6 +28,20 @@ func TestRepositoryRule_UnmarshalJSON(t *testing.T) {
2828 },
2929 wantErr : true ,
3030 },
31+ "With Metadata" : {
32+ data : `{
33+ "type": "creation",
34+ "ruleset_source_type": "Repository",
35+ "ruleset_source": "google",
36+ "ruleset_id": 1984
37+ }` ,
38+ want : & RepositoryRule {
39+ RulesetSource : "google" ,
40+ RulesetSourceType : "Repository" ,
41+ RulesetID : 1984 ,
42+ Type : "creation" ,
43+ },
44+ },
3145 "Valid creation" : {
3246 data : `{"type":"creation"}` ,
3347 want : NewCreationRule (),
@@ -262,9 +276,15 @@ func TestRepositoriesService_GetRulesForBranch(t *testing.T) {
262276 testMethod (t , r , "GET" )
263277 fmt .Fprint (w , `[
264278 {
279+ "ruleset_id": 42069,
280+ "ruleset_source_type": "Repository",
281+ "ruleset_source": "google",
265282 "type": "creation"
266283 },
267284 {
285+ "ruleset_id": 42069,
286+ "ruleset_source_type": "Organization",
287+ "ruleset_source": "google",
268288 "type": "update",
269289 "parameters": {
270290 "update_allows_fetch_and_merge": true
@@ -280,9 +300,15 @@ func TestRepositoriesService_GetRulesForBranch(t *testing.T) {
280300 }
281301
282302 creationRule := NewCreationRule ()
303+ creationRule .RulesetID = 42069
304+ creationRule .RulesetSource = "google"
305+ creationRule .RulesetSourceType = "Repository"
283306 updateRule := NewUpdateRule (& UpdateAllowsFetchAndMergeRuleParameters {
284307 UpdateAllowsFetchAndMerge : true ,
285308 })
309+ updateRule .RulesetID = 42069
310+ updateRule .RulesetSource = "google"
311+ updateRule .RulesetSourceType = "Organization"
286312
287313 want := []* RepositoryRule {
288314 creationRule ,
0 commit comments