Skip to content

Commit

Permalink
Fix mock files and tests to avoid changing the calls at every version…
Browse files Browse the repository at this point in the history
… bump
  • Loading branch information
jmaspons committed Aug 18, 2023
1 parent 176a785 commit 4ea6346
Show file tree
Hide file tree
Showing 24 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="OpenStreetMap server" copyright="OpenStreetMap and contributors" attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/">
<changeset id="266770" created_at="2023-08-04T15:07:55Z" open="true" comments_count="0" changes_count="0" uid="12141" user="jmaspons">
<changeset id="268845" created_at="2023-08-18T16:28:07Z" open="true" comments_count="0" changes_count="0" uid="12141" user="jmaspons">
<tag k="comment" v="Improved description of the changeset"/>
<tag k="created_by" v="osmapiR 0.0.0.10"/>
<tag k="created_by" v="osmapiR"/>
<tag k="hashtags" v="#testing;#osmapiR"/>
</changeset>
</osm>
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="CGImap 0.8.8 (012345 ******.openstreetmap.org)" copyright="OpenStreetMap and contributors" attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/">
<changeset id="266770" created_at="2023-08-04T15:07:55Z" open="true" user="jmaspons" uid="12141" comments_count="0" changes_count="0">
<changeset id="268845" created_at="2023-08-18T16:28:07Z" open="true" user="jmaspons" uid="12141" comments_count="0" changes_count="0">
<tag k="hashtags" v="#testing;#osmapiR"/>
<tag k="source" v="GPS;survey"/>
<tag k="created_by" v="osmapiR 0.0.0.10"/>
<tag k="created_by" v="osmapiR"/>
<tag k="comment" v="Describe the changeset"/>
</changeset>
</osm>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
268845

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
268847

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4333265939
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4333265940

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4304991058

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4306137829
3 changes: 3 additions & 0 deletions tests/testthat/test-changesets.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ test_that("edit changeset (create/update/diff upload) works", {
expect_message(
chset_id <- osm_create_changeset(
comment = "Describe the changeset",
created_by = "osmapiR", # avoid changes in calls when updating version
source = "GPS;survey",
hashtags = "#testing;#osmapiR",
verbose = TRUE
Expand All @@ -45,6 +46,7 @@ test_that("edit changeset (create/update/diff upload) works", {
upd_chaset <- osm_update_changeset(
changeset_id = chset_id,
comment = "Improved description of the changeset",
created_by = "osmapiR", # avoid changes in calls when updating version
hashtags = "#testing;#osmapiR"
)
})
Expand All @@ -71,6 +73,7 @@ test_that("edit changeset (create/update/diff upload) works", {
osm_change_xml <- osmcha_DF2xml(osm_change)

with_mock_dir("mock_diff_up_changeset", {
# TODO: better testing for osm_idff_upload_changeset
# fetch <- list()
# fetch$node <- osm_fetch_objects(osm_type = "nodes", osm_ids = c(35308286, 1935675367))
# fetch$way <- osm_fetch_objects(osm_type = "ways", osm_ids = c(13073736L, 235744929L))
Expand Down
5 changes: 3 additions & 2 deletions tests/testthat/test-elements.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ test_that("edit OSM object works", {
with_mock_dir("mock_edit_objects", {
changeset_id <- osm_create_changeset(
comment = "Test object creation",
created_by = "osmapiR", # avoid changes in calls when updating version
source = "Imagination",
hashtags = "#testing;#osmapiR",
verbose = TRUE
Expand Down Expand Up @@ -105,8 +106,8 @@ test_that("edit OSM object works", {
}

# osm_close_changeset(changeset_id)
# TODO: Error in `resp_body_raw()`: ! Can not retrieve empty body
# error related with httptest2?
# TODO: Error in `resp_body_raw()`: ! Can not retrieve empty body. Fixed in httptest2 > 0.1.0
# https://github.com/nealrichardson/httptest2/pull/28
})

expect_match(create_id, "[0-9]+")
Expand Down

0 comments on commit 4ea6346

Please sign in to comment.