foreman_datacenter 1.22.1 → 1.24.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/foreman_datacenter/application_controller.rb +2 -0
- data/app/controllers/foreman_datacenter/racks_controller.rb +8 -1
- data/app/models/foreman_datacenter/rack.rb +36 -0
- data/app/views/foreman_datacenter/device_roles/show.html.erb +1 -2
- data/app/views/foreman_datacenter/device_types/show.html.erb +1 -2
- data/app/views/foreman_datacenter/manufacturers/show.html.erb +1 -2
- data/app/views/foreman_datacenter/platforms/show.html.erb +1 -2
- data/app/views/foreman_datacenter/rack_groups/show.html.erb +1 -2
- data/app/views/foreman_datacenter/racks/_device_position.html.erb +10 -1
- data/app/views/foreman_datacenter/racks/show.html.erb +1 -2
- data/app/views/foreman_datacenter/sites/show.html.erb +1 -2
- data/config/routes.rb +21 -1
- data/lib/foreman_datacenter/version.rb +1 -1
- data/test/controllers/foreman_datacenter/device_roles_controller_test.rb +133 -0
- data/test/controllers/foreman_datacenter/device_types_contoller_test.rb +108 -47
- data/test/controllers/foreman_datacenter/devices_controller_test.rb +132 -0
- data/test/controllers/foreman_datacenter/manufacturers_controller_test.rb +133 -0
- data/test/controllers/foreman_datacenter/platforms_contoller_test.rb +91 -48
- data/test/controllers/foreman_datacenter/rack_groups_contoller_test.rb +90 -43
- data/test/controllers/foreman_datacenter/racks_contoller_test.rb +111 -42
- data/test/controllers/foreman_datacenter/sites_contoller_test.rb +108 -81
- data/test/datacenter_helper.rb +8 -1
- data/test/factories/device.rb +5 -0
- data/test/factories/device_role.rb +6 -0
- data/test/factories/device_type.rb +30 -0
- data/test/factories/rack_group.rb +13 -14
- data/test/fixtures/foreman_datacenter/device_roles.yml +0 -1
- data/test/integration/foreman_datacenter/device_role_test.rb +35 -0
- data/test/integration/foreman_datacenter/device_type_test.rb +33 -0
- data/test/integration/foreman_datacenter/manufacturer_test.rb +33 -0
- data/test/integration/foreman_datacenter/platform_test.rb +35 -0
- data/test/integration/foreman_datacenter/rack_group_test.rb +35 -25
- data/test/integration/foreman_datacenter/rack_test.rb +37 -25
- data/test/integration/foreman_datacenter/site_test.rb +39 -29
- data/test/unit/foreman_datacenter_test.rb +1 -1
- metadata +56 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa372e8673608cecc9343f4a2efa60d2d38dc77cb9ef37cfd55f8ec261907ccc
|
4
|
+
data.tar.gz: b806528ffcea447652114e76043f216d28eb50c2386f253ca93bd8808ab0ee35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fa308e3840207c9a77aecfaa18491b578a73f5a1307bcea72fabafa1e97d4b3dfcf6bd9386803c847bbc410e75de3515d629c1e12227d4606d5e8385096c721
|
7
|
+
data.tar.gz: 3a00433a5afb85a305c687e66f153dd4279efe62f2ec842d6c67d321085062530dc261529436076b3ea0df0e74136bed184b79b388b98cf34f39eb6ecd0066b9
|
@@ -3,7 +3,7 @@ module ForemanDatacenter
|
|
3
3
|
include Foreman::Controller::AutoCompleteSearch
|
4
4
|
include ForemanDatacenter::Controller::Parameters::Rack
|
5
5
|
|
6
|
-
before_action :find_resource, only: [:show, :edit, :update, :destroy, :devices, :move]
|
6
|
+
before_action :find_resource, only: [:show, :edit, :update, :destroy, :devices, :move, :export_to_csv]
|
7
7
|
|
8
8
|
def index
|
9
9
|
@racks = resource_base_search_and_page.includes(:site, :rack_group)
|
@@ -64,6 +64,13 @@ module ForemanDatacenter
|
|
64
64
|
process_error object: @rack, error_msg: 'Current Rack haven\'t any Devices.' if @devices.empty?
|
65
65
|
end
|
66
66
|
|
67
|
+
def export_to_csv
|
68
|
+
data = @rack.format_for_csv
|
69
|
+
file = File.open("#{@rack.name}.csv", "r")
|
70
|
+
send_file(file)
|
71
|
+
file.close
|
72
|
+
end
|
73
|
+
|
67
74
|
def update_associated_objects
|
68
75
|
begin
|
69
76
|
@rack = ForemanDatacenter::Rack.find(request.env['HTTP_REFERER'].split('/')[-2])
|
@@ -52,8 +52,42 @@ module ForemanDatacenter
|
|
52
52
|
count
|
53
53
|
end
|
54
54
|
|
55
|
+
def format_for_csv
|
56
|
+
positioned_devices = self.positioned_devices
|
57
|
+
unpositioned_devices = self.unpositioned_devices
|
58
|
+
csv_string = CSV.generate do |csv|
|
59
|
+
csv << ["positions", "left", "full", "right", "no side"]
|
60
|
+
positioned_devices.each do |i|
|
61
|
+
pos = i[0].map{|p| "#{p}"+"U"}.join(",")
|
62
|
+
if i[1].size > 0
|
63
|
+
sort = sort_for_csv(i[1])
|
64
|
+
csv << [pos, sort[0], sort[1], sort[2], sort[3]]
|
65
|
+
else
|
66
|
+
csv << [pos]
|
67
|
+
end
|
68
|
+
end
|
69
|
+
unless unpositioned_devices.empty?
|
70
|
+
csv << []
|
71
|
+
csv << ["Unpositioned", unpositioned_devices.map(&:name).join(",")]
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
File.open("#{self.name}.csv", "w") {|f| f << csv_string}
|
76
|
+
end
|
77
|
+
|
55
78
|
private
|
56
79
|
|
80
|
+
def sort_for_csv(device_array)
|
81
|
+
left, full, right, no_side = "", "", "", []
|
82
|
+
device_array.each do |d|
|
83
|
+
left = d.name if d.side == "left"
|
84
|
+
right = d.name if d.side == "right"
|
85
|
+
full = d.name if d.side == "full"
|
86
|
+
no_side << d.name if d.side == nil
|
87
|
+
end
|
88
|
+
[left, full, right, no_side.join(",")]
|
89
|
+
end
|
90
|
+
|
57
91
|
def device_sorting(devices)
|
58
92
|
devices.reverse.map { |d| [d[0].reverse, d[1]] }
|
59
93
|
end
|
@@ -63,5 +97,7 @@ module ForemanDatacenter
|
|
63
97
|
devices.each{|d| devs[1] << d[1][0]}
|
64
98
|
return devs
|
65
99
|
end
|
100
|
+
|
101
|
+
|
66
102
|
end
|
67
103
|
end
|
@@ -1,5 +1,14 @@
|
|
1
1
|
<div class="panel panel-default">
|
2
|
-
<div class="panel-heading text-center"
|
2
|
+
<div class="panel-heading text-center">
|
3
|
+
<h4 class="nonmargintop nonmarginbottom">
|
4
|
+
<strong>
|
5
|
+
<%= link_to _("#{rack.name}"), rack_path(rack) %>
|
6
|
+
</strong>
|
7
|
+
<strong>
|
8
|
+
<%= link_to 'Export to CSV', export_to_csv_rack_path(rack.id), class: "btn btn-primary btn-xs pull-right" %>
|
9
|
+
</strong>
|
10
|
+
</h4>
|
11
|
+
</div>
|
3
12
|
<table class="<%= table_css_classes 'table-hover panel-body nonmarginbottom' %>">
|
4
13
|
<tbody>
|
5
14
|
<% rack.positioned_devices.each do |positions, devices| %>
|
data/config/routes.rb
CHANGED
@@ -74,11 +74,30 @@ Foreman::Application.routes.draw do
|
|
74
74
|
get 'datacenter/import_to_device', to: 'hosts#import_to_device',
|
75
75
|
as: 'import_to_device'
|
76
76
|
|
77
|
-
get '/api/:controller/(:action(/*welcome))'
|
77
|
+
# get '/api/:controller/(:action(/*welcome))'
|
78
78
|
# get '/datacenter/(:controller)/help', :action => 'welcome', :as => "help"
|
79
79
|
|
80
80
|
scope 'datacenter', module: :foreman_datacenter do
|
81
81
|
|
82
|
+
welcoming_controllers = [
|
83
|
+
'console_ports',
|
84
|
+
'device_interface_connections',
|
85
|
+
'device_interface_connections',
|
86
|
+
'device_roles',
|
87
|
+
'device_types',
|
88
|
+
'devices',
|
89
|
+
'manufacturers',
|
90
|
+
'platforms',
|
91
|
+
'power_ports',
|
92
|
+
'rack_groups',
|
93
|
+
'racks',
|
94
|
+
'sites',
|
95
|
+
]
|
96
|
+
|
97
|
+
welcoming_controllers.each do |welcoming_controller|
|
98
|
+
get "#{welcoming_controller}/help", :action => :welcome, :controller => welcoming_controller
|
99
|
+
end
|
100
|
+
|
82
101
|
post :site_update_associated_objects, to: "sites#update_associated_objects"
|
83
102
|
post :rack_group_update_associated_objects, to: "rack_groups#update_associated_objects"
|
84
103
|
post :rack_update_associated_objects, to: "racks#update_associated_objects"
|
@@ -94,6 +113,7 @@ Foreman::Application.routes.draw do
|
|
94
113
|
end
|
95
114
|
resources :racks do
|
96
115
|
member do
|
116
|
+
get :export_to_csv
|
97
117
|
get :move
|
98
118
|
end
|
99
119
|
collection do
|
@@ -0,0 +1,133 @@
|
|
1
|
+
require_relative '../../test_plugin_helper'
|
2
|
+
|
3
|
+
module ForemanDatacenter
|
4
|
+
class DeviceRolesControllerTest < ActionController::TestCase
|
5
|
+
describe ForemanDatacenter::DeviceRolesController do
|
6
|
+
setup do
|
7
|
+
@model = ForemanDatacenter::DeviceRole.first
|
8
|
+
end
|
9
|
+
|
10
|
+
basic_index_test 'device_roles'
|
11
|
+
basic_new_test
|
12
|
+
basic_edit_test 'device_role'
|
13
|
+
basic_pagination_per_page_test
|
14
|
+
basic_pagination_rendered_test
|
15
|
+
|
16
|
+
def test_create_invalid
|
17
|
+
ForemanDatacenter::DeviceRole.any_instance.stubs(:valid?).returns(false)
|
18
|
+
post :create, params: { :device_role => {:name => nil} }, session: set_session_user
|
19
|
+
assert_template 'new'
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_create_valid(name = "test device_role")
|
23
|
+
ForemanDatacenter::DeviceRole.any_instance.stubs(:valid?).returns(true)
|
24
|
+
post :create, params: { :device_role => {:name => name, :color => 'Teal'} }, session: set_session_user
|
25
|
+
assert_redirected_to device_roles_url
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_update_invalid
|
29
|
+
ForemanDatacenter::DeviceRole.any_instance.stubs(:valid?).returns(false)
|
30
|
+
put :update, params: { :id => @model.to_param, :device_role => {:name => "3243", :color => "Red"} }, session: set_session_user
|
31
|
+
assert_template 'edit'
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_update_valid
|
35
|
+
ForemanDatacenter::DeviceRole.any_instance.stubs(:valid?).returns(true)
|
36
|
+
put :update, params: { :id => @model.to_param, :device_role => {:name => @model.name, :color => "Green"} }, session: set_session_user
|
37
|
+
assert_redirected_to device_roles_url
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_destroy
|
41
|
+
test_create_valid "tobedeleted_test"
|
42
|
+
@new_dr = ForemanDatacenter::DeviceRole.find_by_name("tobedeleted_test")
|
43
|
+
delete :destroy, params: { :id => @new_dr.id }, session: set_session_user
|
44
|
+
assert_redirected_to device_roles_url
|
45
|
+
assert !ForemanDatacenter::DeviceRole.exists?(@new_dr.id)
|
46
|
+
end
|
47
|
+
|
48
|
+
test "should not get index when not permitted" do
|
49
|
+
setup_user
|
50
|
+
get :index, session: { :user => users(:one).id, :expires_at => 5.minutes.from_now }
|
51
|
+
assert_response :forbidden
|
52
|
+
assert_includes @response.body, 'view_device_roles'
|
53
|
+
end
|
54
|
+
|
55
|
+
test 'should not get show when not permitted' do
|
56
|
+
setup_user
|
57
|
+
get :show, params: { :id => @model.id }, session: {:user => users(:one).id, :expires_at => 5.minutes.from_now}
|
58
|
+
assert_response :forbidden
|
59
|
+
assert_includes @response.body, 'view_device_roles'
|
60
|
+
end
|
61
|
+
|
62
|
+
test 'should not get edit when not permitted' do
|
63
|
+
setup_user
|
64
|
+
get :edit, params: { :id => @model.id }, session: {:user => users(:one).id, :expires_at => 5.minutes.from_now}
|
65
|
+
assert_response :forbidden
|
66
|
+
assert_includes @response.body, 'edit_device_roles'
|
67
|
+
end
|
68
|
+
|
69
|
+
test "should get index" do
|
70
|
+
setup_user("Viewer")
|
71
|
+
get :index, session: set_session_user
|
72
|
+
assert_response :success
|
73
|
+
assert_template 'index'
|
74
|
+
end
|
75
|
+
|
76
|
+
test 'should get show' do
|
77
|
+
setup_user("Viewer")
|
78
|
+
get :show, params: { :id => @model.id }, session: set_session_user
|
79
|
+
assert_response :success
|
80
|
+
assert_template 'show'
|
81
|
+
end
|
82
|
+
|
83
|
+
test 'should not get edit with viewer permissions' do
|
84
|
+
setup_user("Viewer")
|
85
|
+
get :edit, params: { :id => @model.id }, session: {:user => users(:one).id, :expires_at => 5.minutes.from_now}
|
86
|
+
assert_response :forbidden
|
87
|
+
assert_includes @response.body, 'edit_device_roles'
|
88
|
+
end
|
89
|
+
|
90
|
+
test 'should get edit' do
|
91
|
+
get :edit, params: { :id => @model.id }, session: set_session_user
|
92
|
+
assert_response :success
|
93
|
+
assert_template 'edit'
|
94
|
+
end
|
95
|
+
|
96
|
+
def setup_user(role = "")
|
97
|
+
@request.session[:user] = users(:one).id
|
98
|
+
users(:one).roles = [Role.default]
|
99
|
+
users(:one).roles << Role.find_by_name(role) if role != ""
|
100
|
+
# users(:one).roles = [Role.default, Role.find_by_name("Viewer")]
|
101
|
+
end
|
102
|
+
|
103
|
+
test "should_render_404_when_device_role_is_not_found" do
|
104
|
+
get :show, params: { id: 'no.such.device.role' }, session: set_session_user
|
105
|
+
assert_response :not_found
|
106
|
+
assert_template 'common/404'
|
107
|
+
end
|
108
|
+
|
109
|
+
test "should_not_destroy_device_role_when_not_permitted" do
|
110
|
+
setup_user
|
111
|
+
assert_difference('ForemanDatacenter::DeviceRole.count', 0) do
|
112
|
+
delete :destroy, params: { :id => @model.id }, session: {:user => users(:one).id, :expires_at => 5.minutes.from_now}
|
113
|
+
end
|
114
|
+
assert_response :forbidden
|
115
|
+
end
|
116
|
+
|
117
|
+
test "should search by name" do
|
118
|
+
get :index, params: {:search => "name=\"device_role_1\""}, session: set_session_user
|
119
|
+
assert_response :success
|
120
|
+
refute_empty assigns(:device_roles)
|
121
|
+
assert assigns(:device_roles).include?(device_roles(:one))
|
122
|
+
end
|
123
|
+
|
124
|
+
test "should search by color" do
|
125
|
+
get :index, params: {:search => "color=\"Teal\""}, session: set_session_user
|
126
|
+
assert_response :success
|
127
|
+
refute_empty assigns(:device_roles)
|
128
|
+
assert assigns(:device_roles).include?(device_roles(:one))
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
@@ -13,78 +13,139 @@ module ForemanDatacenter
|
|
13
13
|
basic_pagination_per_page_test
|
14
14
|
basic_pagination_rendered_test
|
15
15
|
|
16
|
-
def
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
def test_create_invalid
|
17
|
+
ForemanDatacenter::DeviceType.any_instance.stubs(:valid?).returns(false)
|
18
|
+
post :create, params: { device_type: { model: nil } }, session: set_session_user
|
19
|
+
assert_template 'new'
|
20
|
+
end
|
20
21
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
def test_show_edit_button_id
|
27
|
-
get :show, params: { :id => ForemanDatacenter::DeviceType.first.to_param }, session: set_session_user
|
28
|
-
assert_select "[data-id='aid_device_types_#{ForemanDatacenter::DeviceType.first.id}_edit']"
|
22
|
+
def test_create_valid(model = "test device_type")
|
23
|
+
ForemanDatacenter::DeviceType.any_instance.stubs(:valid?).returns(true)
|
24
|
+
post :create, params: { device_type: { model: model, manufacturer_id: 1 } }, session: set_session_user
|
25
|
+
assert_redirected_to device_types_url
|
29
26
|
end
|
30
27
|
|
31
|
-
def
|
32
|
-
|
33
|
-
|
28
|
+
def test_update_invalid
|
29
|
+
ForemanDatacenter::DeviceType.any_instance.stubs(:valid?).returns(false)
|
30
|
+
put :update, params: { id: @model.to_param, device_type: { model: '3243', color: 'Red' } }, session: set_session_user
|
31
|
+
assert_template 'edit'
|
34
32
|
end
|
35
33
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
34
|
+
def test_update_valid
|
35
|
+
ForemanDatacenter::DeviceType.any_instance.stubs(:valid?).returns(true)
|
36
|
+
put :update, params: { id: @model.to_param, device_type: { model: @model.model, color: 'Green' } }, session: set_session_user
|
37
|
+
assert_redirected_to device_types_url
|
40
38
|
end
|
41
39
|
|
42
40
|
def test_create_invalid
|
43
41
|
ForemanDatacenter::DeviceType.any_instance.stubs(:valid?).returns(false)
|
44
|
-
post :create, params: { :
|
42
|
+
post :create, params: { device_type: { model: nil } }, session: set_session_user
|
45
43
|
assert_template 'new'
|
46
44
|
end
|
47
45
|
|
48
|
-
def
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
46
|
+
def test_destroy
|
47
|
+
test_create_valid "tobedeleted_test"
|
48
|
+
@new_dt = ForemanDatacenter::DeviceType.find_by_model("tobedeleted_test")
|
49
|
+
delete :destroy, params: { id: @new_dt.id }, session: set_session_user
|
50
|
+
assert_redirected_to device_types_url
|
51
|
+
assert !ForemanDatacenter::DeviceType.exists?(@new_dt.id)
|
53
52
|
end
|
54
53
|
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
test "should not get index when not permitted" do
|
55
|
+
setup_user
|
56
|
+
get :index, session: { :user => users(:one).id, :expires_at => 5.minutes.from_now }
|
57
|
+
assert_response :forbidden
|
58
|
+
assert_includes @response.body, 'view_device_types'
|
58
59
|
end
|
59
60
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
61
|
+
test 'should not get show when not permitted' do
|
62
|
+
setup_user
|
63
|
+
get :show, params: { :id => @model.id }, session: {:user => users(:one).id, :expires_at => 5.minutes.from_now}
|
64
|
+
assert_response :forbidden
|
65
|
+
assert_includes @response.body, 'view_device_types'
|
64
66
|
end
|
65
67
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
68
|
+
test 'should not get edit when not permitted' do
|
69
|
+
setup_user
|
70
|
+
get :edit, params: { :id => @model.id }, session: {:user => users(:one).id, :expires_at => 5.minutes.from_now}
|
71
|
+
assert_response :forbidden
|
72
|
+
assert_includes @response.body, 'edit_device_types'
|
70
73
|
end
|
71
74
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
75
|
+
test "should get index" do
|
76
|
+
setup_user("Viewer")
|
77
|
+
get :index, session: set_session_user
|
78
|
+
assert_response :success
|
79
|
+
assert_template 'index'
|
80
|
+
end
|
81
|
+
|
82
|
+
test 'should get show' do
|
83
|
+
setup_user("Viewer")
|
84
|
+
get :show, params: { :id => @model.id }, session: set_session_user
|
85
|
+
assert_response :success
|
86
|
+
assert_template 'show'
|
87
|
+
end
|
88
|
+
|
89
|
+
test 'should not get edit with viewer permissions' do
|
90
|
+
setup_user("Viewer")
|
91
|
+
get :edit, params: { :id => @model.id }, session: {:user => users(:one).id, :expires_at => 5.minutes.from_now}
|
92
|
+
assert_response :forbidden
|
93
|
+
assert_includes @response.body, 'edit_device_types'
|
79
94
|
end
|
80
95
|
|
81
|
-
|
96
|
+
test 'should get edit' do
|
97
|
+
get :edit, params: { :id => @model.id }, session: set_session_user
|
98
|
+
assert_response :success
|
99
|
+
assert_template 'edit'
|
100
|
+
end
|
101
|
+
|
102
|
+
def setup_user(role = "")
|
82
103
|
@request.session[:user] = users(:one).id
|
83
|
-
users(:one).roles = [Role.default
|
104
|
+
users(:one).roles = [Role.default]
|
105
|
+
users(:one).roles << Role.find_by_name(role) if role != ""
|
106
|
+
# users(:one).roles = [Role.default, Role.find_by_name("Viewer")]
|
107
|
+
end
|
108
|
+
|
109
|
+
test "should_render_404_when_device_type_is_not_found" do
|
110
|
+
get :show, params: { id: 'no.such.device.type' }, session: set_session_user
|
111
|
+
assert_response :not_found
|
112
|
+
assert_template 'common/404'
|
84
113
|
end
|
85
114
|
|
86
|
-
|
87
|
-
|
115
|
+
test "should_not_destroy_device_type_when_not_permitted" do
|
116
|
+
setup_user
|
117
|
+
assert_difference('ForemanDatacenter::DeviceType.count', 0) do
|
118
|
+
delete :destroy, params: { :id => @model.id }, session: {:user => users(:one).id, :expires_at => 5.minutes.from_now}
|
119
|
+
end
|
120
|
+
assert_response :forbidden
|
121
|
+
end
|
122
|
+
|
123
|
+
test "should search by model" do
|
124
|
+
get :index, params: {:search => "model=\"DeviceType_1NONE\""}, session: set_session_user
|
125
|
+
assert_response :success
|
126
|
+
refute_empty assigns(:device_types)
|
127
|
+
assert assigns(:device_types).include?(device_types(:one))
|
128
|
+
end
|
129
|
+
|
130
|
+
test "should search by manufacturer" do
|
131
|
+
get :index, params: {:search => "manufacturer=\"manufacturer_1\""}, session: set_session_user
|
132
|
+
assert_response :success
|
133
|
+
refute_empty assigns(:device_types)
|
134
|
+
assert assigns(:device_types).include?(device_types(:one))
|
135
|
+
end
|
136
|
+
|
137
|
+
test "should search by subdevice role" do
|
138
|
+
get :index, params: {:search => "subdevice_role=\"None\""}, session: set_session_user
|
139
|
+
assert_response :success
|
140
|
+
refute_empty assigns(:device_types)
|
141
|
+
assert assigns(:device_types).include?(device_types(:one))
|
142
|
+
end
|
143
|
+
|
144
|
+
test "should search by U height" do
|
145
|
+
get :index, params: {:search => "u_height=\"1\""}, session: set_session_user
|
146
|
+
assert_response :success
|
147
|
+
refute_empty assigns(:device_types)
|
148
|
+
assert assigns(:device_types).include?(device_types(:one))
|
88
149
|
end
|
89
150
|
end
|
90
151
|
end
|