Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

912 B
Raw Blame
# frozen_string_literal: true

module OAuthConnectionsHelpers
  def mock_one_drive_authorization_validation(with: {})
    me_response = {
      businessPhones: [
        "+45 123 4567 8901"
      ],
      displayName: "Sheev Palpatine ",
      givenName: "Sheev",
      jobTitle: "Galactic Senator",
      mail: "[email protected]",
      mobilePhone: "+45 123 4567 8901",
      officeLocation: "500 Republica",
      preferredLanguage: "en-US",
      surname: "Palpatine",
      userPrincipalName: "[email protected]",
      id: "87d349ed-44d7-43e1-9a83-5f2406dee5bd"
    }.to_json

    stub = stub_request(:get, "https://graph.microsoft.com/v1.0/me")
      .to_return(status: 200, body: me_response, headers: { "Content-Type" => "application/json" })

    if with.present?
      stub.with(with)
    end
  end
end

RSpec.configure do |c|
  c.include OAuthConnectionsHelpers, :oauth_connection_helpers
end