-
Notifications
You must be signed in to change notification settings - Fork 43
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
base: 3.3
Are you sure you want to change the base?
Conversation
bac6619
to
28eddde
Compare
@@ -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' |
There was a problem hiding this comment.
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?
There was a problem hiding this 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?
2acf831
to
a792bf1
Compare
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
0454c4d
to
80a8e77
Compare
80a8e77
to
f5c558b
Compare
No description provided.