def test_get_page_when_org_not_found_raises_expected_error( self, mocker, mock_connection ): text = '[{"name":"SYSTEM","description":"Unable to find org"}]' mock_connection.get.side_effect = create_mock_error( Py42BadRequestError, mocker, text ) service = DeviceService(mock_connection) with pytest.raises(Py42OrgNotFoundError) as err: service.get_page(1, org_uid="TestOrgUid") assert "The organization with UID 'TestOrgUid' was not found." in str(err.value) assert err.value.org_uid == "TestOrgUid"
def test_get_page_calls_get_with_expected_url_and_params(self, mock_connection): service = DeviceService(mock_connection) service.get_page(20, True, True, "org", "user", "dest", True, True, 1000) mock_connection.get.assert_called_once_with( "/api/v1/Computer", params={ "active": True, "blocked": True, "orgUid": "org", "userUid": "user", "targetComputerGuid": "dest", "incBackupUsage": True, "incCounts": True, "pgNum": 20, "pgSize": 1000, "q": None, }, )