Пример #1
0
    def test_get_request_result_raw_content(self, mock_config):
        mock_config.return_value.verify = False
        mock_config.return_value.timeout = 12
        mock_config.return_value.vcac_server = 'fake_server'
        mock_config.return_value.session.get.return_value.text = '{"content": ["fake_data"]}'

        vra_request = VraRequest('')
        vra_request.status_url = "fake_status_url"
        result = vra_request.get_request_result_raw()

        self.assertEqual(result, 'fake_data')
        mock_config.return_value.session.get.assert_called_once_with(
            "fake_status_url/resources", verify=False, timeout=12)
Пример #2
0
    def test_get_request_result_raw_no_content(self, mock_session,
                                               mock_config):
        mock_config.return_value.verify = False
        mock_config.return_value.timeout = 12
        mock_config.return_value.vcac_server = 'fake_server'
        mock_config.return_value.session.get.return_value.text = '{"fake_data":""}'

        vra_request = VraRequest('')
        vra_request.status_url = "fake_status_url"
        result = vra_request.get_request_result_raw()

        self.assertEqual(result, {'fake_data': ''})
        mock_config.return_value.session.get.assert_any_call(
            'fake_status_url/resources', verify=False, timeout=12)
        mock_config.return_value.session.get.assert_any_call(
            'fake_status_url/forms/details', verify=False, timeout=12)