예제 #1
0
    async def send_clear_cache_request(self):  # 发送 请求 send_boot_notification
        print("hello")
        request = call.ClearCachePayload()
        response = await self.call(request)

        if response.status == ClearCacheStatus.accepted:
            print("Clear cache Done!!!!!!!!.")
        print("it works")
예제 #2
0
    async def send_clear_cache_request(self):
        print("1.hello, clear cache request send to client")
        request = call.ClearCachePayload()
        response = await self.call(request)
        # print(response)

        if response.status == ClearCacheStatus.accepted:
            print("3.we can Clear cache")
        elif response.status == ClearCacheStatus.rejected:
            print("client rejected to clear cache")
예제 #3
0
async def test_suppress_call_error(base_central_system):
    """
    Test that getting a CallError will suppress Exception
    by default

    """
    call_error = CallError(
        unique_id='1337',
        error_code="GenericError",
        error_description='test_raise_call_error',
    )
    await base_central_system.route_message(call_error.to_json())

    payload = call.ClearCachePayload()
    await base_central_system.call(payload)
예제 #4
0
    async def send_clear_cache_request(self):
        print("1.hello, clear cache request send to client")
        request = call.ClearCachePayload()
        self.export_json_file(request.__dict__, "./dataFromServer2Cp",
                              "ClearCache.req")

        response = await self.call(request)
        print(response.__dict__)
        self.export_json_file(response.__dict__, "./dataFromServer2Cp",
                              "ClearCache.con")

        if response.status == ClearCacheStatus.accepted:
            print("3.we can Clear cache")
        elif response.status == ClearCacheStatus.rejected:
            print("3.client rejected to clear cache")
예제 #5
0
async def test_raise_call_error(base_central_system):
    """
    Test that getting a CallError will raise an Exception
    if suppress argument is not True.

    """
    call_error = CallError(
        unique_id='1337',
        error_code="GenericError",
        error_description='test_raise_call_error',
    )
    await base_central_system.route_message(call_error.to_json())

    payload = call.ClearCachePayload()
    with pytest.raises(GenericError):
        await base_central_system.call(payload, suppress=False)
예제 #6
0
 async def send_clear_cache(self) -> call_result.ClearCachePayload:
     return await self.call(call.ClearCachePayload())