示例#1
0
    def test_release_rt_cores(self, mock_cloud):
        req = RTCoreRequest('c1', 10, 1)

        mock_cloud.realtime.request.return_value = dict(request_id=10)

        req_id = req.request()
        req.release(req_id)

        mock_cloud.realtime.release.assert_called_once_with(req_id)
示例#2
0
    def test_request(self, mock_cloud):
        req = RTCoreRequest('c1', 10, 1)

        mock_cloud.realtime.request.return_value = dict(request_id=10)

        req_id = req.request()

        mock_cloud.realtime.request.assert_called_once_with('c1', 10, 1)
        eq_(10, req_id)
示例#3
0
    def test_release_rt_cores(self, mock_cloud):
        req = RTCoreRequest('c1', 10, 1)

        mock_cloud.realtime.request.return_value = dict(request_id=10)

        req_id = req.request()
        req.release(req_id)

        mock_cloud.realtime.release.assert_called_once_with(req_id)
示例#4
0
    def test_request(self, mock_cloud):
        req = RTCoreRequest('c1', 10, 1)

        mock_cloud.realtime.request.return_value = dict(request_id=10)

        req_id = req.request()

        mock_cloud.realtime.request.assert_called_once_with('c1', 10, 1)
        eq_(10, req_id)
示例#5
0
    def test_with_with_statement(self, mock_cloud):
        with RTCoreRequest('c1', 10, 1):
            mock_cloud.realtime.request.assert_called_once_with('c1', 10, 1)
            eq_(0, mock_cloud.realtime.release.call_count)

        eq_(1, mock_cloud.realtime.release.call_count)