Beispiel #1
0
    def test_pf_product_li_interaction_with_calls_mock(self):
        self.setup_user_logged_in()
        self.setup_database(True)
        self.client.get('http://*****:*****@class, 'api_call_submit') "
            "and contains(@class, 'btn-info')]"
        )
        mock_results = self.client.find_element_by_class_name(
            'code-blocks-wrapper'
        )
        assert not mock_results.is_displayed(), (
            'Call results should not be displayed yet'
        )
        mock.click()
        time.sleep(1)
        assert mock_results.is_displayed(), (
            'Call results should be displayed and are not'
        )
        self.assertIn(
            'https://{region}',
            mock_results.text,
            'Could not find request URL in mock return'
        )
        self.assertIn(
            '"Content-Type": "application/json"',
            mock_results.text,
            'Could not find request headers content type'
        )
        hide_results = self.client.find_element_by_id('toggle_results')
        self.assertIn(
            hide_results.text,
            'Hide Results',
            'Incorrect wording on hide results button'
        )
        hide_results.click()
        time.sleep(1)
        assert not mock_results.is_displayed(), (
            'Call results should be displayed and are not'
        )
Beispiel #2
0
    def test_pf_user_login_search(self):
        self.setup_user_logged_in()
        self.setup_database(True)
        self.client.get('http://*****:*****@id='test_call-autoscale_form']/input[7]"
        )
        mock_results = self.client.find_element_by_class_name(
            'code-blocks-wrapper'
        )
        assert not mock_results.is_displayed(), (
            'Call results should not be displayed yet'
        )
        mock.click()
        time.sleep(1)
        assert mock_results.is_displayed(), (
            'Call results should be displayed and are not'
        )
        self.assertIn(
            'https://{region}',
            mock_results.text,
            'Could not find request URL in mock return'
        )
        self.assertIn(
            '"Content-Type": "application/json"',
            mock_results.text,
            'Could not find request headers content type'
        )
        hide_results = self.client.find_element_by_id('toggle_results')
        self.assertIn(
            hide_results.text,
            'Hide Results',
            'Incorrect wording on hide results button'
        )
        hide_results.click()
        time.sleep(1)
        assert not mock_results.is_displayed(), (
            'Call results should be displayed and are not'
        )