2 # This file is part of SMR.
4 # SMR is free software: you can redistribute it and/or modify it under the
5 # terms of the GNU General Public License as published by the Free Software
6 # Foundation, either version 3 of the License, or (at your option) any later
9 # SMR is distributed in the hope that it will be useful, but WITHOUT ANY
10 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License along with
14 # SMR. If not, see <http://www.gnu.org/licenses/>.
22 # Typical admin privileged session to test administrating things.
24 class AdminSessionTest < ActionDispatch::IntegrationTest
29 # try to login as privileged admin user
30 test "login as admin" do
31 # see if it takes us to the login page
33 assert_response :redirect, 'accessing / should redirect to /login'
35 assert_response :success
36 assert_equal new_session_path, path
38 smr_login(LOGIN, PASSWORD)
42 # manage (add, edit, delete) securities
43 test "manage securities" do
44 smr_login(LOGIN, PASSWORD)
46 get objects_security_index_path
47 assert_response :success
48 assert_not_nil assigns(:securities)
50 get export_securities_path(:format=>'csv')
51 assert_response :success
52 assert_equal 'text/csv', response.content_type
53 assert CSV.parse(response.body)
59 # manage (add, edit, delete) portfolios
60 test "manage portfolios" do
61 smr_login(LOGIN, PASSWORD)
63 get objects_portfolio_index_path
64 assert_response :success
65 assert_not_nil assigns(:portfolios)
70 # manage (add, edit, delete) FigureVar records
71 test "manage figures" do
72 smr_login(LOGIN, PASSWORD)
74 get objects_figurevar_index_path
75 assert_response :success
76 assert_not_nil assigns(:figurevars)
81 # manage (add, edit) User
83 smr_login(LOGIN, PASSWORD)
85 get objects_user_index_path
86 assert_response :success
87 assert_not_nil assigns(:users)
92 # manage (add, edit) Organization
93 test "manage organization" do
94 smr_login(LOGIN, PASSWORD)
96 get objects_organization_index_path
97 assert_response :success
98 assert_not_nil assigns(:organizations)
103 # manage (add, edit) Bookmark
104 test "manage bookmark" do
105 smr_login(LOGIN, PASSWORD)
107 get objects_bookmark_index_path
108 assert_response :success
109 assert_not_nil assigns(:bookmarks)