class TestToolSessionApp(TestCase2): def setup_method(self,method): # start up a tool session container self.hubname = self.testdata.find_url_for('https') self.username,self.userpass = \ self.testdata.find_account_for('registeredworkspace') self.cm = ContainerManager() self.ws = self.cm.access(host=self.hubname, username=self.username, password=self.userpass) self.session_number,es = self.ws.execute('echo $SESSION') self.ws.close() # setup a web browser self.browser.get(self.https_authority) self.utils.account.login_as(self.username,self.userpass) self.po = self.catalog.load_pageobject('ToolSessionPage', 'workspace',int(self.session_number)) self.po.goto_page() def teardown_method(self,method): # get out of the workspace # shut down the ssh connection self.cm.sync_open_sessions(self.hubname,self.username) def test_terminate_container(self): """ test pressing the terminate button on the app """ # press the terminate button self.po.app.do_terminate() # check that the container terminated po = self.catalog.load_pageobject('MembersDashboardPage') po.goto_page() open_sessions = po.modules.my_sessions.get_session_numbers() assert int(self.session_number) not in open_sessions,\ "after terminating session %s," % (self.session_number) \ + " session still listed as open in my_sessions module" def test_keep_container(self): """ test pressing the keep button on the app """ # press the keep button self.po.app.do_keep() # check that the container is still open po = self.catalog.load_pageobject('MembersDashboardPage') po.goto_page() open_sessions = po.modules.my_sessions.get_session_numbers() assert int(self.session_number) in open_sessions,\ "after keeping session %s," % (self.session_number) \ + " session not listed as open in my_sessions module" # def test_popout_container(self): # """ # test pressing the popout button on the app to popout the app # """ # # browser = self.browser._browser # # # get current window info # url1 = browser.current_url # current_window = browser.current_window_handle # # # press the popout button # self.po.app.do_popout() # # # find the popup window # other_window = None # for w in browser.window_handles: # if w != current_window: # other_window = w # # assert other_window is not None, \ # "after pressing the popout button, no window popped out" # # # def test_popout_container_close(self): # """ # test closing the popped out app does not end the session # """ # # browser = self.browser._browser # # # get current window info # url1 = browser.current_url # current_window = browser.current_window_handle # # # press the popout button # self.po.app.do_popout() # # # find the popup window # other_window = None # for w in browser.window_handles: # if w != current_window: # other_window = w # # assert other_window is not None, \ # "after pressing the popout button, no window popped out" # # # switch to the popup window # browser.switch_to_window(other_window) # # # close the popup window # browser.close() # browser.switch_to_window(current_window) # # # check that the container is still open # po = self.catalog.load_pageobject('MembersDashboardPage') # po.goto_page() # open_sessions = po.modules.my_sessions.get_session_numbers() # # assert int(self.session_number) in open_sessions,\ # "after closing popped out app," \ # + " session %s not listed as open in my_sessions module" \ # % (self.session_number) # # # def test_popout_container_popin(self): # """ # test popping-in a popped out app # """ # # browser = self.browser._browser # # # get current window info # url1 = browser.current_url # current_window = browser.current_window_handle # # # press the popout button # self.po.app.do_popout() # # # find the popup window # other_window = None # for w in browser.window_handles: # if w != current_window: # other_window = w # # assert other_window is not None, \ # "after pressing the popout button, no window popped out" # # # pop the container back in the browser # self.po.app.do_popout() # # # make sure the popped-out window closes # other_window = None # for w in browser.window_handles: # if w != current_window: # other_window = w # # assert other_window is None, \ # "after pressing the 'pop in' button," \ # + " the popped out window still exists" # # # check that the container is still open # po = self.catalog.load_pageobject('MembersDashboardPage') # po.goto_page() # open_sessions = po.modules.my_sessions.get_session_numbers() # # assert int(self.session_number) in open_sessions,\ # "after popping in the tool session container app," \ # + " session %s not listed as open in my_sessions module" \ # % (self.session_number) @hubcheck.utils.hub_version(min_version='1.1.2') @pytest.mark.user_storage def test_storage_meter(self): """ retrieve the free storage amount """ storage_amount = self.po.app.storage.storage_meter() assert storage_amount != '', \ "invalid storage amount returned: %s" % (storage_amount) assert storage_amount != '0% of 0GB', \ "user quotas not activated: storage_amount = %s" % (storage_amount)
class members_dashboard_my_session_item_2(TestCase): def setUp(self): # start up a tool session container self.hubname = self.testdata.find_url_for('https') self.username,self.userpass = \ self.testdata.find_account_for('purdueworkspace') self.cm = ContainerManager() self.ws = self.cm.create(host=self.hubname, username=self.username, password=self.userpass) self.session_number,es = self.ws.execute('echo $SESSION') self.session_number = int(self.session_number) # setup a web browser self.browser.get(self.https_authority) self.utils.account.login_as(self.username,self.userpass) self.po = self.catalog.load_pageobject('GenericPage') self.po.header.goto_myaccount() self.po = self.catalog.load_pageobject('MembersDashboardPage') self.my_sessions_module = self.po.modules.my_sessions def tearDown(self): # get out of the workspace # shut down the ssh connection self.ws.close() # resync our session data because in the test, # we attempted to close a session being tracked by cm self.cm.sync_open_sessions(self.hubname,self.username) @hubcheck.utils.hub_version(min_version='1.1.4') def test_terminate_click_accept(self): """ click the terminate session link and accept the confirmation """ pageurl1 = self.po.current_url() num_sessions_1 = self.my_sessions_module.count_sessions() session_item = self.my_sessions_module.get_session_by_session_number( self.session_number) self.assertTrue(session_item is not None, 'No session exists for session numbered: %s' % (self.session_number)) # open the slide down window if not session_item.is_slide_open(): session_item.toggle_slide() session_item.terminate_session(confirm=True) self.my_sessions_module = self.po.modules.my_sessions session_numbers = self.my_sessions_module.get_session_numbers() self.assertTrue(self.session_number not in session_numbers, "after confirming the termination of a session" + " the session %d still appears in the list of open sessions" % (self.session_number))