Skip to content

Commit

Permalink
Revert "Improve test coverage of functions to edit gps traces"
Browse files Browse the repository at this point in the history
This reverts commit 9c10c9f which
requires nealrichardson/httptest2#40
  • Loading branch information
jmaspons committed Apr 29, 2024
1 parent 9c10c9f commit 26a7b47
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 31 deletions.
Empty file.

This file was deleted.

1 change: 0 additions & 1 deletion tests/testthat/test-changesets.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")])

Expand Down
51 changes: 22 additions & 29 deletions tests/testthat/test-gps_traces.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -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)
})


Expand Down

0 comments on commit 26a7b47

Please sign in to comment.