コード例 #1
0
 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
コード例 #2
0
 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 testCurrentUrlCtxException(self):
        '''check current url context manager works in case of exception'''
        class CustomError(Exception):
            '''a custom error type to catch'''

        try:
            with current_url('https://google.com'):
                self.assertIn('google', SE.current_url)
                raise CustomError("as expected")
        except CustomError as e:
            pass

        self.assertIn('wikipedia', SE.current_url)
コード例 #4
0
    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 + "/")
コード例 #5
0
    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 testCurrentUrlCtx(self):
     '''check current url context manager works'''
     with current_url('https://google.com'):
         self.assertIn('google', SE.current_url)
     self.assertIn('wikipedia', SE.current_url)
コード例 #7
0
 def test_3_LoginCtx(self):
     with current_url(KATELLO.url):
         with login_ctx(KATELLO.username, KATELLO.password):
             SE.get(KATELLO.url + "/sam")
コード例 #8
0
 def _env_ctx(url, username, password, organization):
      with current_url(url):
         with login_ctx(username, password):
             with organisation_ctx(organization):
                 yield
コード例 #9
0
 def test_3_LoginCtx(self):
     with current_url(KATELLO.url):
         with login_ctx(KATELLO.username, KATELLO.password):
             SE.get(KATELLO.url + "/sam")
コード例 #10
0
 def _env_ctx(url, username, password, organization):
     with current_url(url):
         with login_ctx(username, password):
             with organisation_ctx(organization):
                 yield