Beispiel #1
0
 def test_get_by_value_calls_get_with_expected_uri_and_params(
         self, mock_connection):
     device_guid = "42"
     service = ArchiveService(mock_connection)
     for _ in service.get_all_archives_from_value(device_guid,
                                                  "backupSourceGuid"):
         pass
     expected_params = {"pgNum": 1, "pgSize": 500, "backupSourceGuid": "42"}
     mock_connection.get.assert_called_once_with(ARCHIVE_URI,
                                                 params=expected_params)
Beispiel #2
0
 def test_get_all_archives_from_value_calls_get_expected_number_of_times(
     self,
     mock_connection,
     mock_get_archives_response,
     mock_get_archives_empty_response,
 ):
     device_guid = "42"
     py42.settings.items_per_page = 1
     service = ArchiveService(mock_connection)
     mock_connection.get.side_effect = [
         mock_get_archives_response,
         mock_get_archives_response,
         mock_get_archives_empty_response,
     ]
     for _ in service.get_all_archives_from_value(device_guid,
                                                  "backupSourceGuid"):
         pass
     py42.settings.items_per_page = 500
     assert mock_connection.get.call_count == 3