当前位置: 首页>>代码示例>>Python>>正文


Python Flare._ask_for_email方法代码示例

本文整理汇总了Python中utils.flare.Flare._ask_for_email方法的典型用法代码示例。如果您正苦于以下问题:Python Flare._ask_for_email方法的具体用法?Python Flare._ask_for_email怎么用?Python Flare._ask_for_email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在utils.flare.Flare的用法示例。


在下文中一共展示了Flare._ask_for_email方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_endpoint

# 需要导入模块: from utils.flare import Flare [as 别名]
# 或者: from utils.flare.Flare import _ask_for_email [as 别名]
 def test_endpoint(self, mock_config, mock_temp, mock_stfrtime):
     f = Flare()
     f._ask_for_email = lambda: None
     try:
         f.upload(confirmation=False)
         raise Exception('Should fail before')
     except Exception, e:
         self.assertEqual(str(e), "Your request is incorrect: Invalid inputs: 'API key unknown'")
开发者ID:AquaBindi,项目名称:dd-agent,代码行数:10,代码来源:test_flare.py

示例2: test_endpoint

# 需要导入模块: from utils.flare import Flare [as 别名]
# 或者: from utils.flare.Flare import _ask_for_email [as 别名]
    def test_endpoint(self, mock_config, mock_temp, mock_stfrtime):
        f = Flare()
        f._ask_for_email = lambda: None
        f._open_tarfile()
        f._tar.close()

        with self.assertRaises(Exception) as cm:
            f.upload()

        self.assertEqual(str(cm.exception), "Your request is incorrect: Invalid inputs: 'API key unknown'")
开发者ID:SupersonicAds,项目名称:dd-agent,代码行数:12,代码来源:test_flare.py

示例3: test_endpoint

# 需要导入模块: from utils.flare import Flare [as 别名]
# 或者: from utils.flare.Flare import _ask_for_email [as 别名]
    def test_endpoint(self, mock_config, mock_temp, mock_stfrtime):
        if os.environ['FLARE_BROKEN']:
            raise unittest.case.SkipTest('Flare broken, acknowledged')
        f = Flare()
        f._ask_for_email = lambda: None
        f._open_tarfile()
        f._tar.close()

        with self.assertRaises(Exception) as cm:
            f.upload()

        self.assertEqual(str(cm.exception), "Your request is incorrect: Invalid inputs: 'API key unknown'")
开发者ID:jalaziz,项目名称:dd-agent,代码行数:14,代码来源:test_flare.py

示例4: test_upload_no_case

# 需要导入模块: from utils.flare import Flare [as 别名]
# 或者: from utils.flare.Flare import _ask_for_email [as 别名]
    def test_upload_no_case(self, mock_config, mock_tempdir, mock_stfrtime, mock_version, mock_requests):
        f = Flare()
        f._ask_for_email = lambda: '[email protected]'

        assert not mock_requests.called
        f.upload(confirmation=False)
        assert mock_requests.called
        args, kwargs = mock_requests.call_args_list[0]
        self.assertEqual(
            args,
            ('https://6-6-6-flare.agent.datadoghq.com/support/flare?api_key=APIKEY',)
        )
        self.assertEqual(
            kwargs['files']['flare_file'].name,
            os.path.join(get_mocked_temp(), "datadog-agent-1.tar.bz2")
        )
        self.assertEqual(kwargs['data']['case_id'], None)
        self.assertEqual(kwargs['data']['email'], '[email protected]')
        assert kwargs['data']['hostname']
开发者ID:AquaBindi,项目名称:dd-agent,代码行数:21,代码来源:test_flare.py

示例5: test_upload_with_case_proxy

# 需要导入模块: from utils.flare import Flare [as 别名]
# 或者: from utils.flare.Flare import _ask_for_email [as 别名]
    def test_upload_with_case_proxy(self, mock_config, mock_tempdir, mock_stfrtime, mock_version, mock_requests):
        f = Flare(case_id=1337)
        f._ask_for_email = lambda: '[email protected]'

        assert not mock_requests.called
        f.upload()
        assert mock_requests.called
        args, kwargs = mock_requests.call_args_list[0]
        self.assertEqual(
            args,
            ('https://6-6-6-flare.agent.datadoghq.com/support/flare/1337?api_key=APIKEY',)
        )
        self.assertEqual(
            kwargs['files']['flare_file'].name,
            os.path.join(get_mocked_temp(), "datadog-agent-1.tar.bz2")
        )
        self.assertEqual(kwargs['data']['case_id'], 1337)
        self.assertEqual(kwargs['data']['email'], '[email protected]')
        assert kwargs['data']['hostname']
        assert kwargs['proxies']['https'] == 'http://proxy_user:[email protected]:3128'
        assert not kwargs['verify']
开发者ID:7040210,项目名称:dd-agent,代码行数:23,代码来源:test_flare.py

示例6: test_upload_with_case

# 需要导入模块: from utils.flare import Flare [as 别名]
# 或者: from utils.flare.Flare import _ask_for_email [as 别名]
    def test_upload_with_case(self, mock_config, mock_tempdir, mock_stfrtime,
                              mock_version, mock_requests, mock_os_remove):
        f = Flare(case_id=1337)
        f._ask_for_email = lambda: '[email protected]'
        f._open_tarfile()
        f._tar.close()

        assert not mock_requests.called
        f.upload()
        assert mock_requests.called
        args, kwargs = mock_requests.call_args_list[0]
        self.assertEqual(
            args,
            ('https://6-6-6-flare.agent.datadoghq.com/support/flare/1337?api_key=APIKEY',)
        )
        self.assertEqual(
            kwargs['files']['flare_file'].name,
            os.path.join(get_mocked_temp(), "datadog-agent-1.tar.bz2")
        )
        self.assertEqual(kwargs['data']['case_id'], 1337)
        self.assertEqual(kwargs['data']['email'], '[email protected]')
        assert kwargs['data']['hostname']
开发者ID:Everlane,项目名称:dd-agent,代码行数:24,代码来源:test_flare.py


注:本文中的utils.flare.Flare._ask_for_email方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。