@@ -850,3 +850,107 @@ func TestOrganizationsService_ListFailedOrgInvitations(t *testing.T) {
850850 return resp , err
851851 })
852852}
853+
854+ func TestMembership_Marshal (t * testing.T ) {
855+ testJSONMarshal (t , & Membership {}, "{}" )
856+
857+ u := & Membership {
858+ URL : String ("url" ),
859+ State : String ("state" ),
860+ Role : String ("email" ),
861+ OrganizationURL : String ("orgurl" ),
862+ Organization : & Organization {
863+ BillingEmail : String ("be" ),
864+ Blog : String ("b" ),
865+ Company : String ("c" ),
866+ Email : String ("e" ),
867+ TwitterUsername : String ("tu" ),
868+ Location : String ("loc" ),
869+ Name : String ("n" ),
870+ Description : String ("d" ),
871+ IsVerified : Bool (true ),
872+ HasOrganizationProjects : Bool (true ),
873+ HasRepositoryProjects : Bool (true ),
874+ DefaultRepoPermission : String ("drp" ),
875+ MembersCanCreateRepos : Bool (true ),
876+ MembersCanCreateInternalRepos : Bool (true ),
877+ MembersCanCreatePrivateRepos : Bool (true ),
878+ MembersCanCreatePublicRepos : Bool (false ),
879+ MembersAllowedRepositoryCreationType : String ("marct" ),
880+ MembersCanCreatePages : Bool (true ),
881+ MembersCanCreatePublicPages : Bool (false ),
882+ MembersCanCreatePrivatePages : Bool (true ),
883+ },
884+ User : & User {
885+ Login : String ("l" ),
886+ ID : Int64 (1 ),
887+ NodeID : String ("n" ),
888+ URL : String ("u" ),
889+ ReposURL : String ("r" ),
890+ EventsURL : String ("e" ),
891+ AvatarURL : String ("a" ),
892+ },
893+ }
894+
895+ want := `{
896+ "url": "url",
897+ "state": "state",
898+ "role": "email",
899+ "organization_url": "orgurl",
900+ "organization": {
901+ "name": "n",
902+ "company": "c",
903+ "blog": "b",
904+ "location": "loc",
905+ "email": "e",
906+ "twitter_username": "tu",
907+ "description": "d",
908+ "billing_email": "be",
909+ "is_verified": true,
910+ "has_organization_projects": true,
911+ "has_repository_projects": true,
912+ "default_repository_permission": "drp",
913+ "members_can_create_repositories": true,
914+ "members_can_create_public_repositories": false,
915+ "members_can_create_private_repositories": true,
916+ "members_can_create_internal_repositories": true,
917+ "members_allowed_repository_creation_type": "marct",
918+ "members_can_create_pages": true,
919+ "members_can_create_public_pages": false,
920+ "members_can_create_private_pages": true
921+ },
922+ "user": {
923+ "login": "l",
924+ "id": 1,
925+ "node_id": "n",
926+ "avatar_url": "a",
927+ "url": "u",
928+ "events_url": "e",
929+ "repos_url": "r"
930+ }
931+ }`
932+
933+ testJSONMarshal (t , u , want )
934+ }
935+
936+ func TestCreateOrgInvitationOptions_Marshal (t * testing.T ) {
937+ testJSONMarshal (t , & CreateOrgInvitationOptions {}, "{}" )
938+
939+ u := & CreateOrgInvitationOptions {
940+ InviteeID : Int64 (1 ),
941+ Email : String ("email" ),
942+ Role : String ("role" ),
943+ TeamID : []int64 {1 },
944+ }
945+
946+ want := `{
947+ "invitee_id": 1,
948+ "email": "email",
949+ "role": "role",
950+ "team_ids": [
951+ 1
952+ ]
953+ }`
954+
955+ testJSONMarshal (t , u , want )
956+ }
0 commit comments