mno-enterprise-api 2.0.4 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/app/controllers/mno_enterprise/impersonate_controller.rb +2 -1
 - data/app/controllers/mno_enterprise/jpi/v1/app_instances_sync_controller.rb +2 -2
 - data/app/controllers/mno_enterprise/status_controller.rb +4 -2
 - data/app/views/mno_enterprise/jpi/v1/impac/kpis/_kpi.json.jbuilder +1 -1
 - data/spec/controllers/mno_enterprise/impersonate_controller_spec.rb +14 -9
 - data/spec/controllers/mno_enterprise/jpi/v1/app_instances_sync_controller_spec.rb +8 -0
 - data/spec/controllers/mno_enterprise/jpi/v1/impac/kpis_controller_spec.rb +2 -2
 - data/spec/controllers/mno_enterprise/status_controller_spec.rb +4 -0
 - metadata +5 -5
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 946bdc47f1f8bc49a5186e9b31e946ee43d6138d
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 3284bb90d1d1c4324dbcacd8dc06766eac18cb10
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 19b2e1ecd70323064db222edb817653ae82cbd9fd7b0e1737d79ea109f0410431240ae4e1805f69464dcca8a9c5209ff56fb88d360cc36d8770bc8288ec89312
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 8846c11e6b1bf335bb454f0575952b64a27d914678ea191e943eca125805371fce6e53ecbda133f1930c926e61b2471134846a04614ca503086ef061da020168
         
     | 
| 
         @@ -8,6 +8,7 @@ module MnoEnterprise 
     | 
|
| 
       8 
8 
     | 
    
         
             
                # Perform the user impersonate action
         
     | 
| 
       9 
9 
     | 
    
         
             
                # GET /impersonate/user/123
         
     | 
| 
       10 
10 
     | 
    
         
             
                def create
         
     | 
| 
      
 11 
     | 
    
         
            +
                  session[:impersonator_redirect_path] = params[:redirect_path].presence
         
     | 
| 
       11 
12 
     | 
    
         
             
                  @user = MnoEnterprise::User.find(params[:user_id])
         
     | 
| 
       12 
13 
     | 
    
         
             
                  if @user.present?
         
     | 
| 
       13 
14 
     | 
    
         
             
                    impersonate(@user)
         
     | 
| 
         @@ -31,7 +32,7 @@ module MnoEnterprise 
     | 
|
| 
       31 
32 
     | 
    
         
             
                  else
         
     | 
| 
       32 
33 
     | 
    
         
             
                    flash[:notice] = "You weren't impersonating anyone"
         
     | 
| 
       33 
34 
     | 
    
         
             
                  end
         
     | 
| 
       34 
     | 
    
         
            -
                  redirect_to '/admin/'
         
     | 
| 
      
 35 
     | 
    
         
            +
                  redirect_to session.delete(:impersonator_redirect_path).presence || '/admin/'
         
     | 
| 
       35 
36 
     | 
    
         
             
                end
         
     | 
| 
       36 
37 
     | 
    
         | 
| 
       37 
38 
     | 
    
         
             
                private
         
     | 
| 
         @@ -1,5 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module MnoEnterprise
         
     | 
| 
       2 
2 
     | 
    
         
             
              class Jpi::V1::AppInstancesSyncController < Jpi::V1::BaseResourceController
         
     | 
| 
      
 3 
     | 
    
         
            +
                CONNECTOR_STATUS_RUNNING = ['PENDING', 'RUNNING']
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
5 
     | 
    
         
             
                # GET /mnoe/jpi/v1/organization/org-fbba/app_instances_sync
         
     | 
| 
       5 
6 
     | 
    
         
             
                def index
         
     | 
| 
         @@ -28,9 +29,8 @@ module MnoEnterprise 
     | 
|
| 
       28 
29 
     | 
    
         
             
                  def results(connectors)
         
     | 
| 
       29 
30 
     | 
    
         
             
                    {
         
     | 
| 
       30 
31 
     | 
    
         
             
                      connectors: connectors,
         
     | 
| 
       31 
     | 
    
         
            -
                      is_syncing: connectors.any?{|c| c[:status] 
     | 
| 
      
 32 
     | 
    
         
            +
                      is_syncing: connectors.any? { |c| CONNECTOR_STATUS_RUNNING.include?(c[:status]) }
         
     | 
| 
       32 
33 
     | 
    
         
             
                    }
         
     | 
| 
       33 
34 
     | 
    
         
             
                  end
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
35 
     | 
    
         
             
              end
         
     | 
| 
       36 
36 
     | 
    
         
             
            end
         
     | 
| 
         @@ -13,13 +13,15 @@ module MnoEnterprise 
     | 
|
| 
       13 
13 
     | 
    
         
             
                #   {
         
     | 
| 
       14 
14 
     | 
    
         
             
                #     'app-version': '9061048-6811c4a',
         
     | 
| 
       15 
15 
     | 
    
         
             
                #     'mno-enterprise-version': '0.0.1',
         
     | 
| 
       16 
     | 
    
         
            -
                #     'env': 'test'
         
     | 
| 
      
 16 
     | 
    
         
            +
                #     'env': 'test',
         
     | 
| 
      
 17 
     | 
    
         
            +
                #     'mno-api-host': 'https://uat.maestrano.io'
         
     | 
| 
       17 
18 
     | 
    
         
             
                #   }
         
     | 
| 
       18 
19 
     | 
    
         
             
                def version
         
     | 
| 
       19 
20 
     | 
    
         
             
                  data = {
         
     | 
| 
       20 
21 
     | 
    
         
             
                      'app-version' => MnoEnterprise::APP_VERSION,
         
     | 
| 
       21 
22 
     | 
    
         
             
                      'mno-enteprise-version' => MnoEnterprise::VERSION,
         
     | 
| 
       22 
     | 
    
         
            -
                      'env' => Rails.env
         
     | 
| 
      
 23 
     | 
    
         
            +
                      'env' => Rails.env,
         
     | 
| 
      
 24 
     | 
    
         
            +
                      'mno-api-host' => MnoEnterprise.mno_api_host
         
     | 
| 
       23 
25 
     | 
    
         
             
                  }
         
     | 
| 
       24 
26 
     | 
    
         
             
                  render json: data
         
     | 
| 
       25 
27 
     | 
    
         
             
                end
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            json.extract! kpi, :id, : 
     | 
| 
      
 1 
     | 
    
         
            +
            json.extract! kpi, :id, :element_watched, :endpoint, :source, :targets, :settings, :extra_params
         
     | 
| 
         @@ -22,8 +22,6 @@ module MnoEnterprise 
     | 
|
| 
       22 
22 
     | 
    
         
             
                  end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
                  describe "#create" do
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
25 
     | 
    
         
             
                    it do
         
     | 
| 
       28 
26 
     | 
    
         
             
                      expect(controller.current_user.id).to eq(user.id)
         
     | 
| 
       29 
27 
     | 
    
         
             
                      get :create, user_id: user2.id
         
     | 
| 
         @@ -32,17 +30,24 @@ module MnoEnterprise 
     | 
|
| 
       32 
30 
     | 
    
         
             
                  end
         
     | 
| 
       33 
31 
     | 
    
         | 
| 
       34 
32 
     | 
    
         
             
                  describe "#destroy" do
         
     | 
| 
       35 
     | 
    
         
            -
                     
     | 
| 
       36 
     | 
    
         
            -
                      get :create, user_id: user2.id
         
     | 
| 
       37 
     | 
    
         
            -
                    end
         
     | 
| 
      
 33 
     | 
    
         
            +
                    subject { get :destroy }
         
     | 
| 
       38 
34 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
                     
     | 
| 
      
 35 
     | 
    
         
            +
                    context 'without redirect_path' do
         
     | 
| 
      
 36 
     | 
    
         
            +
                      before { get :create, user_id: user2.id }
         
     | 
| 
       40 
37 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
      
 38 
     | 
    
         
            +
                      it { expect(controller.current_user.id).to eq(user2.id) }
         
     | 
| 
       42 
39 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
      
 40 
     | 
    
         
            +
                      it { subject; expect(controller.current_user.id).to eq(user.id) }
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                      it { is_expected.to redirect_to('/admin/') }
         
     | 
| 
      
 43 
     | 
    
         
            +
                    end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                    context 'with a redirect_path' do
         
     | 
| 
      
 46 
     | 
    
         
            +
                      before { get :create, user_id: user2.id, redirect_path: '/admin/redirect#path' }
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                      it { is_expected.to redirect_to('/admin/redirect#path') }
         
     | 
| 
      
 49 
     | 
    
         
            +
                    end
         
     | 
| 
       44 
50 
     | 
    
         
             
                  end
         
     | 
| 
       45 
51 
     | 
    
         
             
                end
         
     | 
| 
       46 
52 
     | 
    
         
             
              end
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
53 
     | 
    
         
             
            end
         
     | 
| 
         @@ -74,6 +74,14 @@ module MnoEnterprise 
     | 
|
| 
       74 
74 
     | 
    
         
             
                    before { subject }
         
     | 
| 
       75 
75 
     | 
    
         
             
                    it { expect(JSON.parse(response.body)['is_syncing']).to be_falsey }
         
     | 
| 
       76 
76 
     | 
    
         
             
                  end
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                  context "when connector is pending" do
         
     | 
| 
      
 79 
     | 
    
         
            +
                    let(:progress_results) { { connectors: [
         
     | 
| 
      
 80 
     | 
    
         
            +
                      HashWithIndifferentAccess.new({name: 'a_name', status: 'PENDING', date: nil})
         
     | 
| 
      
 81 
     | 
    
         
            +
                    ] } }
         
     | 
| 
      
 82 
     | 
    
         
            +
                    before { subject }
         
     | 
| 
      
 83 
     | 
    
         
            +
                    it { expect(JSON.parse(response.body)['is_syncing']).to be_truthy }
         
     | 
| 
      
 84 
     | 
    
         
            +
                  end
         
     | 
| 
       77 
85 
     | 
    
         
             
                end
         
     | 
| 
       78 
86 
     | 
    
         | 
| 
       79 
87 
     | 
    
         
             
                describe "POST #create" do
         
     | 
| 
         @@ -46,7 +46,7 @@ module MnoEnterprise 
     | 
|
| 
       46 
46 
     | 
    
         
             
                end
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
       48 
48 
     | 
    
         
             
                describe 'PUT #update' do
         
     | 
| 
       49 
     | 
    
         
            -
                  let(:kpi_hash) { from_api(kpi)[:data].except(:dashboard).merge( 
     | 
| 
      
 49 
     | 
    
         
            +
                  let(:kpi_hash) { from_api(kpi)[:data].except(:dashboard).merge(element_watched: 'New Watchable') }
         
     | 
| 
       50 
50 
     | 
    
         | 
| 
       51 
51 
     | 
    
         
             
                  subject { put :update, id: kpi.id, kpi: kpi_hash }
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
         @@ -59,7 +59,7 @@ module MnoEnterprise 
     | 
|
| 
       59 
59 
     | 
    
         | 
| 
       60 
60 
     | 
    
         
             
                  it "updates the kpi" do
         
     | 
| 
       61 
61 
     | 
    
         
             
                    subject
         
     | 
| 
       62 
     | 
    
         
            -
                    expect(assigns(:kpi). 
     | 
| 
      
 62 
     | 
    
         
            +
                    expect(assigns(:kpi).element_watched).to eq('New Watchable')
         
     | 
| 
       63 
63 
     | 
    
         
             
                  end
         
     | 
| 
       64 
64 
     | 
    
         | 
| 
       65 
65 
     | 
    
         
             
                  it { subject; expect(response.code).to eq('200') }
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: mno-enterprise-api
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.0.5
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Arnaud Lachaume
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2016- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2016-09-09 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: mno-enterprise-core
         
     | 
| 
         @@ -17,14 +17,14 @@ dependencies: 
     | 
|
| 
       17 
17 
     | 
    
         
             
                requirements:
         
     | 
| 
       18 
18 
     | 
    
         
             
                - - '='
         
     | 
| 
       19 
19 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       20 
     | 
    
         
            -
                    version: 2.0. 
     | 
| 
      
 20 
     | 
    
         
            +
                    version: 2.0.5
         
     | 
| 
       21 
21 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       22 
22 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       23 
23 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       24 
24 
     | 
    
         
             
                requirements:
         
     | 
| 
       25 
25 
     | 
    
         
             
                - - '='
         
     | 
| 
       26 
26 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       27 
     | 
    
         
            -
                    version: 2.0. 
     | 
| 
      
 27 
     | 
    
         
            +
                    version: 2.0.5
         
     | 
| 
       28 
28 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       29 
29 
     | 
    
         
             
              name: jbuilder
         
     | 
| 
       30 
30 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -343,7 +343,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       343 
343 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       344 
344 
     | 
    
         
             
            requirements: []
         
     | 
| 
       345 
345 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       346 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 346 
     | 
    
         
            +
            rubygems_version: 2.5.1
         
     | 
| 
       347 
347 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       348 
348 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       349 
349 
     | 
    
         
             
            summary: Maestrano Enterprise - API
         
     |