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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d613105f43c3f93a8376b256b3ce3b05a734c3e
4
- data.tar.gz: 332b2e86714e9f13de04d67eacb7d1f2e0ab802b
3
+ metadata.gz: 946bdc47f1f8bc49a5186e9b31e946ee43d6138d
4
+ data.tar.gz: 3284bb90d1d1c4324dbcacd8dc06766eac18cb10
5
5
  SHA512:
6
- metadata.gz: 89d5c43708d03e9531d7fc3b15ec67ac704409fd219ed493ed87cf128a8d6b66043c926f704ed454da446fdc6d1f4258f577571a5cc6191e6c924d34933765c1
7
- data.tar.gz: 4383f8f03b6679134a3dd421267fd3fd7ac507864ee10439b2ae68c6c8e3f6b7845091682e032e82d684640f1a9800d6ff2e5b114b998e4046b9b2eae1bf668b
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]=="RUNNING" }
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, :name, :element_watched, :endpoint, :source, :targets, :settings, :extra_params
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
- before do
36
- get :create, user_id: user2.id
37
- end
33
+ subject { get :destroy }
38
34
 
39
- it { expect(controller.current_user.id).to eq(user2.id) }
35
+ context 'without redirect_path' do
36
+ before { get :create, user_id: user2.id }
40
37
 
41
- subject { get :destroy }
38
+ it { expect(controller.current_user.id).to eq(user2.id) }
42
39
 
43
- it { subject; expect(controller.current_user.id).to eq(user.id) }
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(name: 'New Name') }
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).name).to eq('New Name')
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') }
@@ -29,6 +29,10 @@ module MnoEnterprise
29
29
  it 'returns the environment' do
30
30
  expect(data['env']).to eq('test')
31
31
  end
32
+
33
+ it 'returns the mno-api-host' do
34
+ expect(data['mno-api-host']).to eq('https://api-enterprise.maestrano.com')
35
+ end
32
36
  end
33
37
  end
34
38
  end
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
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-08-29 00:00:00.000000000 Z
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.4
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.4
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.4.8
346
+ rubygems_version: 2.5.1
347
347
  signing_key:
348
348
  specification_version: 4
349
349
  summary: Maestrano Enterprise - API