def test_03_hours_ctx(self):
     with current_url(KATELLO.url):
         with login_ctx(KATELLO.username, KATELLO.password):
             with organisation_ctx("ACME_Corporation"):
                 with filters.filter_hours_ctx() as (filters_page, filter_menu):
                     filters_page._navigate()
                     self.filter_menu = filter_menu
                     self.assertNonTimeFields()
                     self.assertHoursField()
                     self.filter_menu = None
 def test_03_hours_ctx(self):
     with current_url(KATELLO.url):
         with login_ctx(KATELLO.username, KATELLO.password):
             with organisation_ctx("ACME_Corporation"):
                 with filters.filter_hours_ctx() as (filters_page,
                                                     filter_menu):
                     filters_page._navigate()
                     self.filter_menu = filter_menu
                     self.assertNonTimeFields()
                     self.assertHoursField()
                     self.filter_menu = None
    def test_01_preserve_status(self):
        '''assert context managers preserve exceptions and SE.current_url'''
        class SurpriseError(RuntimeError):
            '''a surprise error type'''

        with self.assertRaises(SurpriseError):
            with current_url(KATELLO.url):
                self.assertEqual(SE.current_url, KATELLO.url + "/")
                with login_ctx(KATELLO.username, KATELLO.password):
                    self.assertEqual(SE.current_url, KATELLO.url + "/")
                    self.assertEqual(SE.current_url, KATELLO.url + "/")
                    with organisation_ctx("ACME_Corporation"):
                        self.assertEqual(SE.current_url, KATELLO.url + "/")
                        with filters.filter_details_ctx() as (filters_page,
                                                              filter_menu):
                            # ;) self.assertEqual(SE.current_url, KATELLO.url + "/")
                            report_page = filter_menu.run_report()
                            raise SurpriseError("oOops")
                        self.assertEqual(SE.current_url, KATELLO.url + "/")
                    self.assertEqual(SE.current_url, KATELLO.url + "/")
                self.assertEqual(SE.current_url, KATELLO.url + "/")
    def test_01_preserve_status(self):
        '''assert context managers preserve exceptions and SE.current_url'''

        class SurpriseError(RuntimeError):
            '''a surprise error type'''

        with self.assertRaises(SurpriseError):
            with current_url(KATELLO.url):
                self.assertEqual(SE.current_url, KATELLO.url + "/")
                with login_ctx(KATELLO.username, KATELLO.password):
                    self.assertEqual(SE.current_url, KATELLO.url + "/")
                    self.assertEqual(SE.current_url, KATELLO.url + "/")
                    with organisation_ctx("ACME_Corporation"):
                        self.assertEqual(SE.current_url, KATELLO.url + "/")
                        with filters.filter_details_ctx() as (filters_page, filter_menu):
                            # ;) self.assertEqual(SE.current_url, KATELLO.url + "/")
                            report_page = filter_menu.run_report()
                            raise SurpriseError("oOops")
                        self.assertEqual(SE.current_url, KATELLO.url + "/")
                    self.assertEqual(SE.current_url, KATELLO.url + "/")
                self.assertEqual(SE.current_url, KATELLO.url + "/")
 def _env_ctx(url, username, password, organization):
      with current_url(url):
         with login_ctx(username, password):
             with organisation_ctx(organization):
                 yield
Example #6
0
 def test_04_set_acme_corp_organisation_ctx(self):
     with organisation_ctx('ACME_Corporation'):
         self.assertEqual(self.page.organisation_menu.current_organisation,
                          'ACME_Corporation')
 def test_04_set_acme_corp_organisation_ctx(self):
     with organisation_ctx('ACME_Corporation'):
         self.assertEqual(self.page.organisation_menu.current_organisation, 'ACME_Corporation')
 def _env_ctx(url, username, password, organization):
     with current_url(url):
         with login_ctx(username, password):
             with organisation_ctx(organization):
                 yield