Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNOE-406] Added logic to load delisted apps if already in dashboard #644

Open
wants to merge 6 commits into
base: 3.3
Choose a base branch
from

Conversation

MAhsenArif
Copy link
Contributor

No description provided.

@@ -23,6 +23,7 @@ end
# json.connector_version app_instance.oauth_keys[:version]
# end

app_instance.without_tenant = true if params[:data] && params[:data] == 'unscoped'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use unscoped as the params and it'd be:
app_instance.without_tenant = params[:unscoped].present?

Copy link
Contributor

@ouranos ouranos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
But I don't think the test case cover the extra functionality added here?

context 'with unscoped data' do
before { allow_any_instance_of(MnoEnterprise::AppInstance).to receive(:without_tenant).and_return(true) }

it 'retrived the app instance with the app' do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

retrieved


before do
organizations = [organization]
allow(organizations).to receive(:loaded?).and_return(true)
allow_any_instance_of(MnoEnterprise::User).to receive(:organizations).and_return(organizations)
allow_any_instance_of(MnoEnterprise::AppInstance).to receive(:app).and_return(app)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't that mean we have a N+1 here?

  • 1 Org with N App Instances
  • Fetch N apps?

context 'with unscoped data' do
before { allow_any_instance_of(MnoEnterprise::AppInstance).to receive(:without_tenant).and_return(true) }

it 'retrieved the app instance with the app' do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this spec is testing much since you're stubbing AppInstance#app

It should be something like this (comments inlined):

# remove the MnoEnterprise::AppInstance#without_tenant and MnoEnterprise::AppInstance#app stubs
context 'with unscoped data' do
  subject { get :index, organization_id: organization.id, timestamp: timestamp, unscoped: true }

  it 'retrieves the unscoped app' do
    # Test that we do the correct request to mnohub
    expect(MnoEnterprise::App).to receive(:find).with(app.id, {unscoped: true).and_return(app)
    subject
    # This test is pretty useless as we're testing something stubbed but let's keep it
    expect(app_instance.app).to eq(app)
  end
end

@MAhsenArif MAhsenArif force-pushed the delisted_apps_logo branch 4 times, most recently from 0454c4d to 80a8e77 Compare February 26, 2018 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants