@@ -710,8 +710,151 @@ module SpecHelper
710710
711711 def mock_channel_send_msg
712712 WebMock .stub(:post , " https://graph.microsoft.com/v1.0/teams/fbe2bf47-16c8-47cf-b4a5-4b9b187c508b/channels/19%3A4a95f7d8db4c4e7fae857bcebe0623e6%40thread.tacv2/messages" )
713- .with(body: " {\" body\" :{\" content\" :\" Hello World\" ,\" contentType\" :\" TEXT\" }}" , headers: {" Authorization" => " Bearer access_token" , " Content-Type" => " application/json" , " Prefer" => " IdType=\" ImmutableId\" " })
714- .to_return(status: 201 , body: " " )
713+ .with(body: " {\" body\" :{\" content\" :\" test\" ,\" contentType\" :\" TEXT\" }}" , headers: {" Authorization" => " Bearer access_token" , " Content-Type" => " application/json" , " Prefer" => " IdType=\" ImmutableId\" " })
714+ .to_return(status: 201 , body: mock_get_channel_message)
715+ end
716+
717+ def mock_list_applications
718+ WebMock .stub(:get , " https://graph.microsoft.com/v1.0/applications" )
719+ .to_return(body: mock_list_applications_resp)
720+ end
721+
722+ def mock_create_applications
723+ WebMock .stub(:post , " https://graph.microsoft.com/v1.0/applications" )
724+ .to_return(body: mock_create_application_resp)
725+ end
726+
727+ def mock_applications_add_pwd
728+ WebMock .stub(:post , " https://graph.microsoft.com/v1.0/applications%28appId%3D%27my-app%27%29/addPassword" )
729+ .with(body: " {\" passwordCredential\" :{\" displayName\" :\" Password friendly name\" }}" , headers: {" Authorization" => " Bearer access_token" , " Content-Type" => " application/json" , " Prefer" => " IdType=\" ImmutableId\" " })
730+ .to_return(body: mock_application_add_pwd_resp)
731+ end
732+
733+ def mock_get_application_id_and_web
734+ WebMock .stub(:get , " https://graph.microsoft.com/v1.0/applications%28appId%3D%27my-app%27%29?%24select=id%2Cweb" )
735+ .to_return(body: mock_get_app_id_and_web_resp)
736+ end
737+
738+ def mock_list_applications_resp
739+ %(
740+ {
741+ "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#applications",
742+ "value": [
743+ {
744+ "appId": "00000000-0000-0000-0000-000000000000",
745+ "identifierUris": [ "http://contoso/" ],
746+ "displayName": "My app",
747+ "publisherDomain": "contoso.com",
748+ "signInAudience": "AzureADMyOrg"
749+ }
750+ ]
751+ }
752+ )
753+ end
754+
755+ def mock_create_application_resp
756+ %(
757+ {
758+ "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#applications/$entity",
759+ "id": "03ef14b0-ca33-4840-8f4f-d6e91916010e",
760+ "deletedDateTime": null,
761+ "isFallbackPublicClient": null,
762+ "appId": "631a96bc-a705-4eda-9f99-fdaf9f54f6a2",
763+ "applicationTemplateId": null,
764+ "identifierUris": [],
765+ "createdDateTime": "2019-09-17T19:10:35.2742618Z",
766+ "displayName": "Display name",
767+ "isDeviceOnlyAuthSupported": null,
768+ "groupMembershipClaims": null,
769+ "optionalClaims": null,
770+ "addIns": [],
771+ "publisherDomain": "contoso.com",
772+ "samlMetadataUrl": "https://graph.microsoft.com/2h5hjaj542de/app",
773+ "signInAudience": "AzureADandPersonalMicrosoftAccount",
774+ "tags": [],
775+ "tokenEncryptionKeyId": null,
776+ "api": {
777+ "requestedAccessTokenVersion": 2,
778+ "acceptMappedClaims": null,
779+ "knownClientApplications": [],
780+ "oauth2PermissionScopes": [],
781+ "preAuthorizedApplications": []
782+ },
783+ "appRoles": [],
784+ "publicClient": {
785+ "redirectUris": []
786+ },
787+ "info": {
788+ "termsOfServiceUrl": null,
789+ "supportUrl": null,
790+ "privacyStatementUrl": null,
791+ "marketingUrl": null,
792+ "logoUrl": null
793+ },
794+ "keyCredentials": [],
795+ "parentalControlSettings": {
796+ "countriesBlockedForMinors": [],
797+ "legalAgeGroupRule": "Allow"
798+ },
799+ "passwordCredentials": [],
800+ "requiredResourceAccess": [],
801+ "web": {
802+ "redirectUris": [],
803+ "homePageUrl": null,
804+ "logoutUrl": null,
805+ "implicitGrantSettings": {
806+ "enableIdTokenIssuance": false,
807+ "enableAccessTokenIssuance": false
808+ }
809+ }
810+ }
811+
812+ )
813+ end
814+
815+ def mock_application_add_pwd_resp
816+ %(
817+ {
818+ "customKeyIdentifier": null,
819+ "endDateTime": "2021-09-09T19:50:29.3086381Z",
820+ "keyId": "f0b0b335-1d71-4883-8f98-567911bfdca6",
821+ "startDateTime": "2019-09-09T19:50:29.3086381Z",
822+ "secretText": "[6gyXA5S20@MN+WRXAJ]I-TO7g1:h2P8",
823+ "hint": "[6g",
824+ "displayName": "Password friendly name"
825+ }
826+ )
827+ end
828+
829+ def mock_get_app_id_and_web_resp
830+ %(
831+ {
832+ "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#applications(id,web)/$entity",
833+ "id": "870cf357-927e-4d71-9f81-6ca278227636",
834+ "web": {
835+ "homePageUrl": null,
836+ "logoutUrl": "https://localhost/auth/logout",
837+ "redirectUris": [
838+ "https://example.com",
839+ "https://mydomain.com/auth/login"
840+ ],
841+ "implicitGrantSettings": {
842+ "enableAccessTokenIssuance": false,
843+ "enableIdTokenIssuance": false
844+ },
845+ "redirectUriSettings": [
846+ {
847+ "uri": "https:/localhost:8843",
848+ "index": null
849+ },
850+ {
851+ "uri": "https://localhost:8843/auth/login",
852+ "index": null
853+ }
854+ ]
855+ }
856+ }
857+ )
715858 end
716859end
717860
0 commit comments