Commit fcb7b31c authored by Dennis Tang's avatar Dennis Tang

fix tests for new cluster POST

parent 5b3345a0
...@@ -176,7 +176,7 @@ describe Projects::ClustersController do ...@@ -176,7 +176,7 @@ describe Projects::ClustersController do
cluster: { cluster: {
name: 'new-cluster', name: 'new-cluster',
provider_gcp_attributes: { provider_gcp_attributes: {
gcp_project_id: '111' gcp_project_id: 'gcp-project-12345'
} }
} }
} }
...@@ -219,6 +219,22 @@ describe Projects::ClustersController do ...@@ -219,6 +219,22 @@ describe Projects::ClustersController do
end end
describe 'security' do describe 'security' do
before do
allow_any_instance_of(described_class)
.to receive(:token_in_session).and_return('token')
allow_any_instance_of(described_class)
.to receive(:expires_at_in_session).and_return(1.hour.since.to_i.to_s)
allow_any_instance_of(GoogleApi::CloudPlatform::Client)
.to receive(:projects_zones_clusters_create) do
OpenStruct.new(
self_link: 'projects/gcp-project-12345/zones/us-central1-a/operations/ope-123',
status: 'RUNNING'
)
end
allow(WaitForClusterCreationWorker).to receive(:perform_in).and_return(nil)
end
it { expect { go }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:admin) }
it { expect { go }.to be_allowed_for(:owner).of(project) } it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { go }.to be_allowed_for(:master).of(project) } it { expect { go }.to be_allowed_for(:master).of(project) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment