Exemplo n.º 1
0
 def test_parse_request_invalid_hLimit(self):
     with pytest.raises(falcon.HTTPInvalidParam):
         request = MagicMock()
         request.params.keys.return_value = ['hLimit','dateFrom','dateTo']
         req_content = {"hLimit":"test"}
         request.params.__getitem__.side_effect = lambda key: req_content[key]
         DeviceHistory.parse_request(request,"test")
Exemplo n.º 2
0
 def test_parse_request_should_raised_invalid_param_exception_when_lastN_is_not_number(
         self):
     with pytest.raises(falcon.HTTPInvalidParam):
         request = MagicMock()
         request.params.keys.return_value = ['lastN', 'dateFrom', 'dateTo']
         req_content = {"lastN": "test"}
         request.params.__getitem__.side_effect = lambda key: req_content[
             key]
         DeviceHistory.parse_request(request, "test")
Exemplo n.º 3
0
 def test_parse_request__should_return_valid_query__when_firstN_is_entered(
         self):
     request = MagicMock()
     request.params.keys.return_value = ['firstN', 'dateFrom', 'dateTo']
     req_content = {
         "firstN": 2,
         "dateFrom": "20190901",
         "dateTo": "20190910"
     }
     request.params.__getitem__.side_effect = lambda key: req_content[key]
     assert DeviceHistory.parse_request(request, 'test')
Exemplo n.º 4
0
 def test_parse_request2(self):
     request = MagicMock()
     request.params.keys.return_value = ['lastN','dateFrom','dateTo']
     req_content = {"lastN":2,"dateFrom":"20190901" ,"dateTo":"20190910"}
     request.params.__getitem__.side_effect = lambda key: req_content[key]
     assert DeviceHistory.parse_request(request,'test')