From 26a7b473062a917ec21e29c859a9797db79c1db2 Mon Sep 17 00:00:00 2001 From: Joan Maspons Date: Mon, 29 Apr 2024 18:33:07 +0200 Subject: [PATCH] Revert "Improve test coverage of functions to edit gps traces" This reverts commit 9c10c9f673bf5e77a2eabf0498004798b28a1669 which requires https://github.com/nealrichardson/httptest2/pull/40 --- .../osm.org/api/0.6/gpx/2456-DELETE.html | 0 .../api/0.6/gpx/create-bb8430-POST.txt | 1 - tests/testthat/test-changesets.R | 1 - tests/testthat/test-gps_traces.R | 51 ++++++++----------- 4 files changed, 22 insertions(+), 31 deletions(-) delete mode 100644 tests/testthat/mock_edit_gpx/osm.org/api/0.6/gpx/2456-DELETE.html delete mode 100644 tests/testthat/mock_edit_gpx/osm.org/api/0.6/gpx/create-bb8430-POST.txt diff --git a/tests/testthat/mock_edit_gpx/osm.org/api/0.6/gpx/2456-DELETE.html b/tests/testthat/mock_edit_gpx/osm.org/api/0.6/gpx/2456-DELETE.html deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/testthat/mock_edit_gpx/osm.org/api/0.6/gpx/create-bb8430-POST.txt b/tests/testthat/mock_edit_gpx/osm.org/api/0.6/gpx/create-bb8430-POST.txt deleted file mode 100644 index 13f740d5..00000000 --- a/tests/testthat/mock_edit_gpx/osm.org/api/0.6/gpx/create-bb8430-POST.txt +++ /dev/null @@ -1 +0,0 @@ -2456 \ No newline at end of file diff --git a/tests/testthat/test-changesets.R b/tests/testthat/test-changesets.R index bfcffebb..04489651 100644 --- a/tests/testthat/test-changesets.R +++ b/tests/testthat/test-changesets.R @@ -85,7 +85,6 @@ test_that("edit changeset (create/update/diff upload) works", { file.remove(path_del) expect_type(chset_id, "character") - expect_match(chset_id, "^[0-9]+$") expect_s3_class(upd_chaset, c("osmapi_changesets", "data.frame"), exact = TRUE) expect_identical(chaset[, setdiff(names(chaset), "tags")], upd_chaset[, setdiff(names(upd_chaset), "tags")]) diff --git a/tests/testthat/test-gps_traces.R b/tests/testthat/test-gps_traces.R index 5a8bac18..4f97ea10 100644 --- a/tests/testthat/test-gps_traces.R +++ b/tests/testthat/test-gps_traces.R @@ -15,17 +15,11 @@ class_columns <- list( test_that("osm_get_points_gps works", { pts_gps <- list() - xml_gps <- list() with_mock_dir("mock_get_points_gps", { pts_gps$private <- osm_get_points_gps(bbox = c(-0.4789191, 38.1662652, -0.4778007, 38.1677898)) pts_gps$public <- osm_get_points_gps(bbox = c(-0.6430006, 38.1073445, -0.6347179, 38.1112953)) - - xml_gps$private <- osm_get_points_gps(bbox = c(-0.4789191, 38.1662652, -0.4778007, 38.1677898), format = "gpx") - xml_gps$public <- osm_get_points_gps(bbox = c(-0.6430006, 38.1073445, -0.6347179, 38.1112953), format = "gpx") }) - lapply(xml_gps, expect_s3_class, "xml_document") - lapply(pts_gps, expect_type, "list") lapply(pts_gps, expect_s3_class, "osmapi_gpx") lapply(pts_gps$private, expect_named, setdiff(column_pts_gps, "time")) @@ -59,32 +53,31 @@ test_that("osm_get_points_gps works", { }) -test_that("edit gpx works", { - gpx_path <- test_path("sample_files", "sample.gpx") - - with_mock_dir("mock_edit_gpx", { - ## Create: `POST /api/0.6/gpx/create` ---- - - create_trace_id <- osm_create_gpx( - file = gpx_path, - description = "Test create gpx with osmapiR.", - tags = c("testing", "osmapiR") - ) - ## Update: `PUT /api/0.6/gpx/#id` ---- - # upd_trace <- osm_update_gpx(gpx_id = create_trace_id, file = gpx_path) - # TODO: HTTP 400 Bad Request. Cannot parse valid trace from xml string - - - ## Delete: `DELETE /api/0.6/gpx/#id` ---- - - del_trace <- osm_delete_gpx(gpx_id = create_trace_id) - }) +test_that("edit gpx works", { + gpx_path <- test_path("sample_files", "sample.gpx") - expect_type(create_trace_id, "character") - expect_match(create_trace_id, "^[0-9]+$") - expect_null(del_trace) + # with_mock_dir("mock_edit_gpx", { + # # TODO: Error in x$value : $ operator is invalid for atomic vectors + # # Called from: rawToChar(x$value) + # ## Create: `POST /api/0.6/gpx/create` ---- + # create_trace <- osm_create_gpx( + # file = gpx_path, + # description = "Test create gpx with osmapiR.", + # tags = c("testing", "osmapiR") + # ) + # + # ## Update: `PUT /api/0.6/gpx/#id` ---- + # # upd_trace <- osm_update_gpx(gpx_id = create_trace, file = gpx_path) + # # TODO: HTTP 400 Bad Request. Cannot parse valid trace from xml string + # + # ## Delete: `DELETE /api/0.6/gpx/#id` ---- + # del_trace <- osm_delete_gpx(gpx_id = create_trace) + # }) + # + # expect_type(create_trace, "character") + # expect_null(del_trace) })