Repository: google/go-github (go)

Issue:
feat: Support getting an organization role
Support getting an organization role. [Docs here](https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/organization-roles?apiVersion=2022-11-28#get-an-organization-role)

I can also work on this

Pull request:
feat: Support getting an organization role
Resolves #3282 

It was only possible to list organization roles before, this makes it possible to get a specific one. 

I might have went overboard with the test-cases (testing both a custom role and a built-in one). I haven't written mocks before, so I'm not sure what the best practices are here 😅

Patch:
diff --git a/AUTHORS b/AUTHORS
index 075ba8df..d2116450 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -13,7 +13,10 @@
 413x <dedifferentiator@gmail.com>
 6543 <6543@obermui.de>
 Abed Kibbe <abed.kibbe@gmail.com>
+Abhijit Hota <abhihota025@gmail.com>
 Abhinav Gupta <mail@abhinavg.net>
+abhishek <abhishek@exaforce.com>
+Abhishek Sharma <abhishekbiyala@gmail.com>
 Abhishek Veeramalla <abhishek.veeramalla@gmail.com>
 aboy <b1011211@gmail.com>
 Adam Kohring <ajkohring@gmail.com>
@@ -35,19 +38,24 @@ Alex Orr <Alexorr.CSE@gmail.com>
 Alex Su <alexsu@17.media>
 Alex Unger <zyxancf@gmail.com>
 Alexander Harkness <me@bearbin.net>
+Alexey Alekhin <laughedelic@gmail.com>
 Alexis Gauthiez <alexis.gauthiez@gmail.com>
 Ali Farooq <ali.farooq0@pm.me>
+Alin Balutoiu <alinbalutoiu@gmail.com>
 Allan Guwatudde <guwats10@gmail.com>
 Allen Sun <shlallen1990@gmail.com>
 Amey Sakhadeo <me@ameyms.com>
 Anders Janmyr <anders@janmyr.com>
+Andreas Deininger <andreas@deininger.net>
 Andreas Garnæs <https://github.com/andreas>
 Andrew Ryabchun <aryabchun@mail.ua>
 Andrew Svoboda <svoboda.andrew@gmail.com>
+Andriyun <andriy.yun@gmail.com>
 Andy Grunwald <andygrunwald@gmail.com>
 Andy Hume <andyhume@gmail.com>
 Andy Lindeman <andy@lindeman.io>
 angie pinilla <angelinepinilla@gmail.com>
+Anish Rajan <anishrajan2708@gmail.com>
 anjanashenoy <anjanashenoy1@gmail.com>
 Anshuman Bhartiya <anshuman.bhartiya@gmail.com>
 Antoine <antoine.tu@mail.mcgill.ca>
@@ -59,6 +67,7 @@ aprp <doelaudi@gmail.com>
 apurwaj2 <apurwaj2@gmail.com>
 Aravind <aravindkp@outlook.in>
 Arda Kuyumcu <kuyumcuarda@gmail.com>
+Ary <arylmoraesn@hotmail.com>
 Arıl Bozoluk <arilbozoluk@hotmail.com>
 Asier Marruedo <asiermarruedo@gmail.com>
 Austin Burdine <acburdine@gmail.com>
@@ -66,9 +75,11 @@ Austin Dizzy <dizzy@wow.com>
 Azuka Okuleye <azuka@zatechcorp.com>
 Ben Batha <bhbatha@gmail.com>
 Benjamen Keroack <benjamen@dollarshaveclub.com>
+Benjamin Nater <benjamin@nater.net>
 Berkay Tacyildiz <berkaytacyildiz@gmail.com>
 Beshr Kayali <beshrkayali@gmail.com>
 Beyang Liu <beyang.liu@gmail.com>
+billnapier <napier@pobox.com>
 Billy Keyes <bluekeyes@gmail.com>
 Billy Lynch <wlynch92@gmail.com>
 Bingtan Lu <lubingtan@126.com>
@@ -93,6 +104,7 @@ Cami Diez <diezcami@gmail.com>
 Carl Johnson <me@carlmjohnson.net>
 Carlos Alexandro Becker <caarlos0@gmail.com>
 Carlos Tadeu Panato Junior <ctadeu@gmail.com>
+Casey <casey.duquette@snapchat.com>
 ChandanChainani <chainanichan@gmail.com>
 chandresh-pancholi <chandreshpancholi007@gmail.com>
 Charles Fenwick Elliott <Charles@FenwickElliott.io>
@@ -109,6 +121,7 @@ Christian Muehlhaeuser <muesli@gmail.com>
 Christoph Jerolimov <jerolimov@gmail.com>
 Christoph Sassenberg <defsprite@gmail.com>
 CI Monk <ci-monk@protonmail.com>
+Clemens W <Clemens.wijnekus@nordnet.se>
 Colin Misare <github.com/cmisare>
 Craig Gumbley <craiggumbley@gmail.com>
 Craig Peterson <cpeterson@stackoverflow.com>
@@ -137,6 +150,7 @@ DeviousLab <deviouslab@gmail.com>
 Dhi Aurrahman <diorahman@rockybars.com>
 Diego Lapiduz <diego.lapiduz@cfpb.gov>
 Diogo Vilela <be0x74a@gmail.com>
+Dion Gionet Mallet <dionmallet@hotmail.com>
 Dmitri Shuralyov <shurcooL@gmail.com>
 dmnlk <seikima2demon@gmail.com>
 Don Petersen <don@donpetersen.net>
@@ -149,9 +163,12 @@ Eli Uriegas <seemethere101@gmail.com>
 Elliott Beach <elliott2.71828@gmail.com>
 Emerson Wood <emersonwood94@gmail.com>
 Emil V <emil.vaagland@schibsted.com>
+Emma Sax <esselbach_briley@simplelogin.com>
 Eng Zer Jun <engzerjun@gmail.com>
+Enrico Candino <enrico.candino@gmail.com>
 eperm <staffordworrell@gmail.com>
 Erick Fejta <erick@fejta.com>
+Erik Elkins <erik.elkins@outlook.com>
 Erik Nobel <hendrik.nobel@transferwise.com>
 erwinvaneyk <erwinvaneyk@gmail.com>
 Evan Anderson <evan.k.anderson@gmail.com>
@@ -163,6 +180,7 @@ Federico Di Pierro <nierro92@gmail.com>
 Felix Geisendörfer <felix@debuggable.com>
 Filippo Valsorda <hi@filippo.io>
 Florian Forster <ff@octo.it>
+Florian Maier <florianmaier101178@gmail.com>
 Florian Wagner <h2floh@github.com>
 Francesc Gil <xescugil@gmail.com>
 Francis <hello@francismakes.com>
@@ -178,6 +196,7 @@ Glen Mailer <glenjamin@gmail.com>
 Gnahz <p@oath.pl>
 Google Inc.
 Grachev Mikhail <work@mgrachev.com>
+Gregory Oschwald <oschwald@gmail.com>
 griffin_stewie <panterathefamilyguy@gmail.com>
 guangwu <guoguangwu@magic-shield.com>
 Guillaume Jacquet <guillaume.jacquet@gmail.com>
@@ -202,6 +221,7 @@ ishan upadhyay <ishanupadhyay412@gmail.com>
 isqua <isqua@isqua.ru>
 Jacob Valdemar <jan@lunar.app>
 Jake Krammer <jake.krammer1@gmail.com>
+Jake Scaltreto <jake.scaltreto@circle.com>
 Jake White <jake@jwhite.network>
 Jameel Haffejee <RC1140@republiccommandos.co.za>
 James Bowes <jbowes@repl.ca>
@@ -210,6 +230,7 @@ James Loh <github@jloh.co>
 James Maguire <jvm986@gmail.com>
 James Turley <jamesturley1905@googlemail.com>
 Jamie West <jamieianwest@hotmail.com>
+Jan Guth <Jan.Guth@gmail.com>
 Jan Kosecki <jan.kosecki91@gmail.com>
 Jan Švábík <jansvabik@jansvabik.cz>
 Jason Field <Jason@avon-lea.co.uk>
@@ -224,6 +245,7 @@ Jihoon Chung <j.c@navercorp.com>
 Jille Timmermans <jille@quis.cx>
 Jimmi Dyson <jimmidyson@gmail.com>
 Joan Saum <joan.saum@epitech.eu>
+JoannaaKL <joannaakl@github.com>
 Joe Tsai <joetsai@digital-static.net>
 John Barton <jrbarton@gmail.com>
 John Engelman <john.r.engelman@gmail.com>
@@ -232,6 +254,7 @@ John Liu <john.liu@mongodb.com>
 Jordan Brockopp <jdbro94@gmail.com>
 Jordan Burandt <jordanburandt@gmail.com>
 Jordan Sussman <jordansail22@gmail.com>
+Jorge Ferrero <jorgeferrerolinacero@gmail.com>
 Jorge Gómez Reus <j-g1996@live.com>
 Joshua Bezaleel Abednego <joshua.bezaleel@gmail.com>
 João Cerqueira <joao@cerqueira.io>
@@ -240,6 +263,7 @@ jpbelanger-mtl <jp.belanger@gmail.com>
 Juan <juan.rios.28@gmail.com>
 Juan Basso <jrbasso@gmail.com>
 Julien Garcia Gonzalez <garciagonzalez.julien@gmail.com>
+Julien Midedji <Julien.Midedji@gmail.com>
 Julien Rostand <jrostand@users.noreply.github.com>
 Junya Kono <junya03dance@gmail.com>
 Justin Abrahms <justin@abrah.ms>
@@ -257,6 +281,7 @@ Kevin Burke <kev@inburke.com>
 Kevin Wang <kwangsan@gmail.com>
 Kevin Zhao <kzhao@lyft.com>
 kgalli <mail@kgalli.de>
+Khanh Ngo <k@ndk.name>
 Kirill <g4s8.public@gmail.com>
 Konrad Malawski <konrad.malawski@project13.pl>
 Kookheon Kwon <kucuny@gmail.com>
@@ -266,10 +291,12 @@ Kshitij Saraogi <KshitijSaraogi@gmail.com>
 Kumar Saurabh <itsksaurabh@gmail.com>
 Kyle Kurz <kyle@doublekaudio.com>
 kyokomi <kyoko1220adword@gmail.com>
+Lachlan Cooper <lachlancooper@gmail.com>
 Lars Lehtonen <lars.lehtonen@gmail.com>
 Laurent Verdoïa <verdoialaurent@gmail.com>
 leopoldwang <leopold.wang@gmail.com>
 Liam Galvin <liam@liam-galvin.co.uk>
+Liam Stanley <liam@liam.sh>
 Lluis Campos <lluis.campos@northern.tech>
 Lovro Mažgon <lovro.mazgon@gmail.com>
 Loïs Postula <lois@postu.la>
@@ -283,6 +310,8 @@ Luke Kysow <lkysow@gmail.com>
 Luke Roberts <email@luke-roberts.co.uk>
 Luke Young <luke@hydrantlabs.org>
 lynn [they] <lynncyrin@gmail.com>
+Léo Salé <leo.sale@datadoghq.com>
+M. Ryan Rigdon <mr.rigdon@gmail.com>
 Magnus Kulke <mkulke@gmail.com>
 Maksim Zhylinski <uzzable@gmail.com>
 Marc Binder <marcandrebinder@gmail.com>
@@ -294,6 +323,7 @@ Martins Sipenko <martins.sipenko@gmail.com>
 Marwan Sulaiman <marwan.sameer@gmail.com>
 Masayuki Izumi <m@izum.in>
 Mat Geist <matgeist@gmail.com>
+Matheus Santos Araújo <wenked.matheus@yahoo.com.br>
 Matija Horvat <horvat2112@gmail.com>
 Matin Rahmanian <itsmatinx@gmail.com>
 Matt <alpmatthew@gmail.com>
@@ -301,6 +331,7 @@ Matt Brender <mjbrender@gmail.com>
 Matt Dainty <matt@bodgit-n-scarper.com>
 Matt Gaunt <matt@gauntface.co.uk>
 Matt Landis <landis.matt@gmail.com>
+Matt Mencel <matt@techminer.net>
 Matt Moore <mattmoor@vmware.com>
 Matt Simons <mattsimons@ntlworld.com>
 Matthew Reidy <matthewreidy5@gmail.com>
@@ -312,8 +343,11 @@ Michał Glapa <michal.glapa@gmail.com>
 Michelangelo Morrillo <michelangelo@morrillo.it>
 Miguel Elias dos Santos <migueleliasweb@gmail.com>
 Mike Chen <mchen300@gmail.com>
+Mishin Nikolai <sanduku.default@gmail.com>
 mohammad ali <2018cs92@student.uet.edu.pk>
 Mohammed AlDujaili <avainer11@gmail.com>
+Mohammed Nafees <hello@mnafees.me>
+Mudit <zeusdeux@gmail.com>
 Mukundan Senthil <mukundan314@gmail.com>
 Munia Balayil <munia.247@gmail.com>
 Mustafa Abban <mustafaabban@utexas.edu>
@@ -321,16 +355,20 @@ Nadav Kaner <nadavkaner1@gmail.com>
 Naoki Kanatani <k12naoki@gmail.com>
 Nathan VanBenschoten <nvanbenschoten@gmail.com>
 Navaneeth Suresh <navaneeths1998@gmail.com>
+Nayeem Hasan <nayeemhasan.nh01@gmail.com>
 Neal Caffery <neal1991@sina.com>
 Neil O'Toole <neilotoole@apache.org>
+Nicholas Herring <oss@hakshak.com>
 Nick Miyake <nmiyake@palantir.com>
 Nick Platt <hello@nickplatt.co.uk>
 Nick Spragg <nick.spragg@bbc.co.uk>
 Nicolas Chapurlat <nc@coorganix.com>
 Nikhita Raghunath <nikitaraghunath@gmail.com>
+Nikita Pivkin <nikita.pivkin@smartforce.io>
 Nilesh Singh <nilesh.singh24@outlook.com>
 Noah Hanjun Lee <noah.lee@buzzvil.com>
 Noah Zoschke <noah+sso2@convox.com>
+Noble Varghese <noblekvarghese96@gmail.com>
 ns-cweber <cweber@narrativescience.com>
 nxya <nathacutlan@gmail.com>
 Ole Orhagen <ole.orhagen@northern.tech>
@@ -358,6 +396,7 @@ Pierce McEntagart <pierce@nightfall.ai>
 Pierre Carrier <pierre@meteor.com>
 Piotr Zurek <p.zurek@gmail.com>
 Piyush Chugh <piyushchugh1993@gmail.com>
+Pj Meyer <peej.meyer@gmail.com>
 Pratik Mallya <pratik.mallya@gmail.com>
 Qais Patankar <qaisjp@gmail.com>
 Quang Le Hong <iamquang95@gmail.com>
@@ -370,6 +409,7 @@ Rafael Aramizu Gomes <rafael.aramizu@mercadolivre.com>
 Rajat Jindal <rajatjindal83@gmail.com>
 Rajendra arora <rajendraarora16@yahoo.com>
 Rajkumar <princegosavi12@gmail.com>
+Ramesh Gaikwad <rameshgkwd05@gmail.com>
 Ranbir Singh <binkkatal.r@gmail.com>
 Ravi Shekhar Jethani <rsjethani@gmail.com>
 RaviTeja Pothana <ravi-teja@live.com>
@@ -379,18 +419,23 @@ Reetuparna Mukherjee <reetuparna.1988@gmail.com>
 reeves122 <reeves122@gmail.com>
 Reinier Timmer <reinier.timmer@ah.nl>
 Renjith R <renjithr201097@gmail.com>
+Rez Moss <hi@rezmoss.com>
+Riaje <francois@mbfr.fr>
 Ricco Førgaard <ricco@fiskeben.dk>
 Richard de Vries <richard.de.vries@topicus.nl>
 Rob Figueiredo <robfig@yext.com>
 Rohit Upadhyay <urohit011@gmail.com>
 Rojan Dinc <rojand94@gmail.com>
+Roming22 <roming22@gmail.com>
 Ronak Jain <ronakjain@outlook.in>
 Ronan Pelliard <ronan.pelliard@datadoghq.com>
 Ross Gustafson <srgustafson8@icloud.com>
 Ruben Vereecken <rubenvereecken@gmail.com>
+Rufina Talalaeva <rufusnorbert14@gmail.com>
 Russell Boley <raboley@gmail.com>
 Ryan Leung <rleungx@gmail.com>
 Ryan Lower <rpjlower@gmail.com>
+Ryan Skidmore <github@ryanskidmore.co.uk>
 Ryo Nakao <nakabonne@gmail.com>
 Saaarah <sarah.liusy@gmail.com>
 Safwan Olaimat <safwan.olaimat@gmail.com>
@@ -452,6 +497,9 @@ Tingluo Huang <tingluohuang@github.com>
 tkhandel <tarunkhandelwal.iitr@gmail.com>
 Tobias Gesellchen <tobias@gesellix.de>
 Tom Payne <twpayne@gmail.com>
+Tomasz Adam Skrzypczak <tomasz.adam.skrzypczak@protonmail.com>
+tomfeigin <tom.feigin@gmail.com>
+Travis Tomsu <travis.tomsu@gmail.com>
 Trey Tacon <ttacon@gmail.com>
 tsbkw <tsbkw0@gmail.com>
 ttacon <ttacon@gmail.com>
@@ -483,7 +531,8 @@ Yurii Soldak <ysoldak@gmail.com>
 Yusef Mohamadi <yuseferi@gmail.com>
 Yusuke Kuoka <ykuoka@gmail.com>
 Zach Latta <zach@zachlatta.com>
+Ze Peng <zehui.peng@circle.com>
 zhouhaibing089 <zhouhaibing089@gmail.com>
 六开箱 <lkxed@outlook.com>
 缘生 <i@ysicing.me>
-蒋航 <hang.jiang@daocloud.io>
\ No newline at end of file
+蒋航 <hang.jiang@daocloud.io>
diff --git a/github/github-accessors.go b/github/github-accessors.go
index a99a06aa..a025f781 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -4414,6 +4414,14 @@ func (c *CreateOrUpdateCustomRepoRoleOptions) GetName() string {
 	return *c.Name
 }
 
+// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise.
+func (c *CreateOrUpdateOrgRoleOptions) GetBaseRole() string {
+	if c == nil || c.BaseRole == nil {
+		return ""
+	}
+	return *c.BaseRole
+}
+
 // GetDescription returns the Description field if it's non-nil, zero value otherwise.
 func (c *CreateOrUpdateOrgRoleOptions) GetDescription() string {
 	if c == nil || c.Description == nil {
diff --git a/github/orgs_custom_roles.go b/github/orgs_custom_roles.go
index ca0c6d7b..7743ec57 100644
--- a/github/orgs_custom_roles.go
+++ b/github/orgs_custom_roles.go
@@ -54,6 +54,7 @@ type CreateOrUpdateOrgRoleOptions struct {
 	Name        *string  `json:"name,omitempty"`
 	Description *string  `json:"description,omitempty"`
 	Permissions []string `json:"permissions"`
+	BaseRole    *string  `json:"base_role,omitempty"`
 }
 
 // CreateOrUpdateCustomRepoRoleOptions represents options required to create or update a custom repository role.
@@ -87,6 +88,29 @@ func (s *OrganizationsService) ListRoles(ctx context.Context, org string) (*Orga
 	return customRepoRoles, resp, nil
 }
 
+// GetOrgRole gets an organization role in this organization.
+// In order to get organization roles in an organization, the authenticated user must be an organization owner, or have access via an organization role.
+//
+// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#get-an-organization-role
+//
+//meta:operation GET /orgs/{org}/organization-roles/{role_id}
+func (s *OrganizationsService) GetOrgRole(ctx context.Context, org string, roleID int64) (*CustomOrgRoles, *Response, error) {
+	u := fmt.Sprintf("orgs/%v/organization-roles/%v", org, roleID)
+
+	req, err := s.client.NewRequest("GET", u, nil)
+	if err != nil {
+		return nil, nil, err
+	}
+
+	resultingRole := new(CustomOrgRoles)
+	resp, err := s.client.Do(ctx, req, resultingRole)
+	if err != nil {
+		return nil, resp, err
+	}
+
+	return resultingRole, resp, err
+}
+
 // CreateCustomOrgRole creates a custom role in this organization.
 // In order to create custom roles in an organization, the authenticated user must be an organization owner.
 //


Test patch:
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index 2db51bab..ae380160 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -5179,6 +5179,16 @@ func TestCreateOrUpdateCustomRepoRoleOptions_GetName(tt *testing.T) {
 	c.GetName()
 }
 
+func TestCreateOrUpdateOrgRoleOptions_GetBaseRole(tt *testing.T) {
+	var zeroValue string
+	c := &CreateOrUpdateOrgRoleOptions{BaseRole: &zeroValue}
+	c.GetBaseRole()
+	c = &CreateOrUpdateOrgRoleOptions{}
+	c.GetBaseRole()
+	c = nil
+	c.GetBaseRole()
+}
+
 func TestCreateOrUpdateOrgRoleOptions_GetDescription(tt *testing.T) {
 	var zeroValue string
 	c := &CreateOrUpdateOrgRoleOptions{Description: &zeroValue}
diff --git a/github/orgs_custom_roles_test.go b/github/orgs_custom_roles_test.go
index 338eac19..a4268b28 100644
--- a/github/orgs_custom_roles_test.go
+++ b/github/orgs_custom_roles_test.go
@@ -98,6 +98,105 @@ func TestOrganizationsService_ListRoles(t *testing.T) {
 	})
 }
 
+func TestOrganizationsService_GetOrgRole(t *testing.T) {
+	client, mux, _, teardown := setup()
+	defer teardown()
+
+	// Test built-in org role
+	mux.HandleFunc("/orgs/o/organization-roles/8132", func(w http.ResponseWriter, r *http.Request) {
+		testMethod(t, r, "GET")
+		fmt.Fprint(w, `{
+			"id": 8132,
+			"name": "all_repo_read",
+			"description": "Grants read access to all repositories in the organization.",
+			"permissions": [],
+			"created_at": `+referenceTimeStr+`,
+			"updated_at": `+referenceTimeStr+`,
+			"source": "Predefined",
+			"base_role": "read"
+		}`)
+	})
+
+	ctx := context.Background()
+
+	gotBuiltInRole, _, err := client.Organizations.GetOrgRole(ctx, "o", 8132)
+	if err != nil {
+		t.Errorf("Organizations.GetOrgRole returned error: %v", err)
+	}
+
+	wantBuiltInRole := &CustomOrgRoles{
+		ID:          Int64(8132),
+		Name:        String("all_repo_read"),
+		Description: String("Grants read access to all repositories in the organization."),
+		Permissions: []string{},
+		CreatedAt:   &Timestamp{referenceTime},
+		UpdatedAt:   &Timestamp{referenceTime},
+		Source:      String("Predefined"),
+		BaseRole:    String("read"),
+	}
+
+	if !cmp.Equal(gotBuiltInRole, wantBuiltInRole) {
+		t.Errorf("Organizations.GetOrgRole returned %+v, want %+v", gotBuiltInRole, wantBuiltInRole)
+	}
+
+	// Test custom org role
+	mux.HandleFunc("/orgs/o/organization-roles/123456", func(w http.ResponseWriter, r *http.Request) {
+		testMethod(t, r, "GET")
+		fmt.Fprint(w, `{
+			"id": 123456,
+			"name": "test-role",
+			"description": "test-role",
+			"permissions": [
+				"read_organization_custom_org_role",
+				"read_organization_custom_repo_role",
+				"write_organization_custom_org_role"
+			],
+			"created_at": `+referenceTimeStr+`,
+			"updated_at": `+referenceTimeStr+`,
+			"source": "Organization",
+			"base_role": null
+			}`)
+	})
+
+	gotCustomRole, _, err := client.Organizations.GetOrgRole(ctx, "o", 123456)
+	if err != nil {
+		t.Errorf("Organizations.GetOrgRole returned error: %v", err)
+	}
+
+	wantCustomRole := &CustomOrgRoles{
+		ID:          Int64(123456),
+		Name:        String("test-role"),
+		Description: String("test-role"),
+		Permissions: []string{
+			"read_organization_custom_org_role",
+			"read_organization_custom_repo_role",
+			"write_organization_custom_org_role",
+		},
+		CreatedAt: &Timestamp{referenceTime},
+		UpdatedAt: &Timestamp{referenceTime},
+		Source:    String("Organization"),
+		BaseRole:  nil,
+	}
+
+	if !cmp.Equal(gotCustomRole, wantCustomRole) {
+		t.Errorf("Organizations.GetOrgRole returned %+v, want %+v", gotCustomRole, wantCustomRole)
+	}
+
+	const methodName = "GetOrgRole"
+	testBadOptions(t, methodName, func() (err error) {
+		_, _, err = client.Organizations.GetOrgRole(ctx, "\no", -8132)
+		return err
+	})
+
+	testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
+		got, resp, err := client.Organizations.GetOrgRole(ctx, "o", 8132)
+		if got != nil {
+			t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
+		}
+		return resp, err
+	})
+}
+
 func TestOrganizationsService_CreateCustomOrgRole(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()