From 2ed83614acd4de843db3975d79d140dbf8f10340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Sat, 20 Jun 2020 13:53:34 +0200 Subject: [PATCH] try testing upload --- inst/post-example2/index.Rmd | 2 +- inst/post-example2/index.md | 4 +- tests/fixtures/example2.yml | 445 +++------------------------------- tests/testthat/test-wp_post.R | 6 +- 4 files changed, 40 insertions(+), 417 deletions(-) diff --git a/inst/post-example2/index.Rmd b/inst/post-example2/index.Rmd index 8c89853..65879e3 100644 --- a/inst/post-example2/index.Rmd +++ b/inst/post-example2/index.Rmd @@ -1,5 +1,5 @@ --- -title: "Another Rmd Blog Post" +title: "My New Rmd Blog Post" date: "2020-04-01T00:00:00" slug: "post-rmd" excerpt: "Here I summarize this fantastic post" diff --git a/inst/post-example2/index.md b/inst/post-example2/index.md index 35976a8..cb4fe98 100644 --- a/inst/post-example2/index.md +++ b/inst/post-example2/index.md @@ -1,5 +1,5 @@ --- -title: "yay rmd" +title: "My New Rmd Blog Post" date: "2020-04-01T00:00:00" slug: "post-rmd" excerpt: "Here I summarize this fantastic post" @@ -7,7 +7,7 @@ output: hugodown::md_document bibliography: refs.bib suppress-bibliography: true csl: chicago-fullnote-bibliography.csl -rmd_hash: 5c196b65a646789f +rmd_hash: 9c145321f1b914be --- diff --git a/tests/fixtures/example2.yml b/tests/fixtures/example2.yml index 8a0d5bd..a478eb1 100644 --- a/tests/fixtures/example2.yml +++ b/tests/fixtures/example2.yml @@ -4,7 +4,7 @@ http_interactions: uri: https://rmd-wordpress.eu/wp-json/wp/v2/posts body: encoding: '' - string: '{"date":"2020-04-01T00:00:00","title":"yay rmd","slug":"post-rmd","status":"draft","content":"

R Markdown<\/h2>\n

A citation1<\/sup><\/a>. R is cool2<\/sup><\/a>.<\/p>\n

This is an R Markdown document. @@ -54,7 +54,7 @@ http_interactions: reason: Created message: 'Success: (201) Created' headers: - date: Sat, 20 Jun 2020 06:54:05 GMT + date: Sat, 20 Jun 2020 11:50:26 GMT content-type: application/json; charset=UTF-8 transfer-encoding: chunked connection: keep-alive @@ -68,51 +68,14 @@ http_interactions: expires: Wed, 11 Jan 1984 05:00:00 GMT cache-control: no-cache, must-revalidate, max-age=0 allow: GET, POST - location: https://rmd-wordpress.eu/wp-json/wp/v2/posts/181 - x-iplb-instance: '32683' - set-cookie: SERVERID112363=2820161|Xu2yk|Xu2yk; path=/ + location: https://rmd-wordpress.eu/wp-json/wp/v2/posts/189 + x-iplb-instance: '32684' + set-cookie: SERVERID112363=2820161|Xu34B|Xu34B; path=/ body: encoding: UTF-8 file: no - string: '{"id":181,"date":"2020-04-01T00:00:00","date_gmt":"2020-03-31T22:00:00","guid":{"rendered":"https:\/\/rmd-wordpress.eu\/?p=181","raw":"https:\/\/rmd-wordpress.eu\/?p=181"},"modified":"2020-04-01T00:00:00","modified_gmt":"2020-03-31T22:00:00","password":"","slug":"post-rmd","status":"draft","type":"post","link":"https:\/\/rmd-wordpress.eu\/?p=181","title":{"raw":"yay - rmd","rendered":"yay rmd"},"content":{"raw":"

R Markdown<\/h2>\n

A - citation1<\/sup><\/a>. - R is cool2<\/sup><\/a>.<\/p>\n

This - is an R Markdown document. Markdown is a simple formatting syntax for authoring - HTML, PDF, and MS Word documents. For more details on using R Markdown see - http:\/\/rmarkdown.rstudio.com<\/a>.<\/p>\n

When - you click the Knit<\/strong> button a document will be generated that - includes both content as well as the output of any embedded R code chunks - within the document. You can embed an R code chunk like this:<\/p>\n

\n
summary<\/a><\/span>(cars<\/span>)\n#>      speed           dist       <\/span>\n#>  Min.   : 4.0   Min.   :  2.00  <\/span>\n#>  1st
-        Qu.:12.0   1st Qu.: 26.00  <\/span>\n#>  Median :15.0   Median
-        : 36.00  <\/span>\n#>  Mean   :15.4   Mean   : 42.98  <\/span>\n#>  3rd Qu.:19.0   3rd Qu.: 56.00  <\/span>\n#>  Max.   :25.0   Max.   :120.00<\/span><\/code><\/pre>\n<\/div>\n

Including Plots<\/h2>\n

You can also embed plots, - for example:<\/p>\n

\n

<\/p>\n<\/div>\n

Note - that the echo = FALSE<\/code> parameter was added to the code chunk - to prevent printing of the R code that generated the plot.<\/p>\n

Another - plot<\/h2>\n
\n
plot<\/a><\/span>(1<\/span>:<\/span>10<\/span>,
-        col = 3<\/span>)\n<\/code><\/pre>\n

<\/p>\n<\/div>\n

Some other thing<\/h2>\n
\n
sqrt<\/a><\/span>(4<\/span>)\n#> [1] 2<\/span><\/code><\/pre>\n<\/div>\n
\n
\n
    \n
  1. Rich FitzJohn et al., - Jqr: Client for \u2018Jq\u2019, a \u2018Json\u2019 Processor<\/em>, 2018, - https:\/\/CRAN.R-project.org\/package=jqr<\/a>.\u21a9\ufe0e<\/a><\/p><\/li>\n

  2. R Core Team, R: A Language and Environment for Statistical - Computing<\/em> (Vienna, Austria: R Foundation for Statistical Computing, - 2020), https:\/\/www.R-project.org\/<\/a>.\u21a9\ufe0e<\/a><\/p><\/li>\n<\/ol>\n<\/div>","rendered":"

    R Markdown<\/h2>\n

    A citation1<\/sup><\/a>. R is cool2<\/sup><\/a>.<\/p>\n

    This is an R Markdown document. @@ -143,122 +106,6 @@ http_interactions: class=''chroma''>sqrt<\/a><\/span>(4<\/span>)\n#> [1] 2<\/span><\/code><\/pre>\n<\/div>\n

    \n
    \n
      \n
    1. \n

      Rich FitzJohn et - al., Jqr: Client for \u2018Jq\u2019, a \u2018Json\u2019 Processor<\/em>, - 2018, https:\/\/CRAN.R-project.org\/package=jqr<\/a>.\u21a9\ufe0e<\/a><\/p>\n<\/li>\n

    2. \n

      R Core Team, R: A Language and Environment for Statistical - Computing<\/em> (Vienna, Austria: R Foundation for Statistical Computing, - 2020), https:\/\/www.R-project.org\/<\/a>.\u21a9\ufe0e<\/a><\/p>\n<\/li>\n<\/ol>\n<\/div>\n","protected":false,"block_version":0},"excerpt":{"raw":"Here - I summarize this fantastic post","rendered":"

      Here I summarize this fantastic - post<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"permalink_template":"https:\/\/rmd-wordpress.eu\/%postname%\/","generated_slug":"yay-rmd","_links":{"self":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"collection":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/comments?post=181"}],"version-history":[{"count":0,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181\/revisions"}],"wp:attachment":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/media?parent=181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/categories?post=181"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/tags?post=181"}],"wp:action-publish":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-unfiltered-html":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-sticky":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-assign-author":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-create-categories":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-assign-categories":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-create-tags":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-assign-tags":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}' - recorded_at: 2020-06-20 06:54:07 GMT - recorded_with: vcr/0.4.2.93, webmockr/0.6.2.92 -- request: - method: post - uri: https://rmd-wordpress.eu/wp-json/wp/v2/posts/181 - body: - encoding: '' - string: '{"date":"2020-04-01T00:00:00","title":"yay rmd","slug":"post-rmd","status":"publish","content":"

      R Markdown<\/h2>\n

      A citation1<\/sup><\/a>. R is cool2<\/sup><\/a>.<\/p>\n

      This is an R Markdown document. - Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word - documents. For more details on using R Markdown see http://rmarkdown.rstudio.com<\/a>.<\/p>\n

      When you click the - Knit<\/strong> button a document will be generated that includes both - content as well as the output of any embedded R code chunks within the document. - You can embed an R code chunk like this:<\/p>\n

      \n
      summary<\/a><\/span>(cars<\/span>)\n#>      speed           dist       <\/span>\n#>  Min.   :
      -        4.0   Min.   :  2.00  <\/span>\n#>  1st Qu.:12.0   1st
      -        Qu.: 26.00  <\/span>\n#>  Median :15.0   Median : 36.00  <\/span>\n#>  Mean   :15.4   Mean   : 42.98  <\/span>\n#>  3rd
      -        Qu.:19.0   3rd Qu.: 56.00  <\/span>\n#>  Max.   :25.0   Max.   :120.00<\/span><\/code><\/pre>\n<\/div>\n

      Including Plots<\/h2>\n

      You can also embed plots, - for example:<\/p>\n

      \n

      <\/p>\n<\/div>\n

      Note - that the echo = FALSE<\/code> parameter was added to the code chunk - to prevent printing of the R code that generated the plot.<\/p>\n

      Another - plot<\/h2>\n
      \n
      plot<\/a><\/span>(1<\/span>:<\/span>10<\/span>,
      -        col = 3<\/span>)\n<\/code><\/pre>\n

      <\/p>\n<\/div>\n

      Some other thing<\/h2>\n
      \n
      sqrt<\/a><\/span>(4<\/span>)\n#> [1] 2<\/span><\/code><\/pre>\n<\/div>\n
      \n
      \n
        \n
      1. Rich FitzJohn et al., Jqr: Client for ‘Jq’, - a ‘Json’ Processor<\/em>, 2018, https://CRAN.R-project.org/package=jqr<\/a>.↩︎<\/a><\/p><\/li>\n

      2. R Core Team, - R: A Language and Environment for Statistical Computing<\/em> (Vienna, - Austria: R Foundation for Statistical Computing, 2020), https://www.R-project.org/<\/a>.↩︎<\/a><\/p><\/li>\n<\/ol>\n<\/div>","excerpt":"Here - I summarize this fantastic post","format":"standard"}' - headers: - Accept: application/json, text/xml, application/xml, */* - Authorization: Basic bWFlbGxlLW5vdC1hZG1pbjo3M1pPIEpnUTUgOVdsUSA3am51IFJBMlggeWRQeA== - Content-Type: application/json - response: - status: - status_code: 200 - category: Success - reason: OK - message: 'Success: (200) OK' - headers: - date: Sat, 20 Jun 2020 06:54:05 GMT - content-type: application/json; charset=UTF-8 - transfer-encoding: chunked - connection: keep-alive - server: Apache - x-powered-by: PHP/7.2 - x-robots-tag: noindex - link: ; rel="https://api.w.org/" - x-content-type-options: nosniff - access-control-expose-headers: X-WP-Total, X-WP-TotalPages - access-control-allow-headers: Authorization, Content-Type - expires: Wed, 11 Jan 1984 05:00:00 GMT - cache-control: no-cache, must-revalidate, max-age=0 - allow: GET, POST, PUT, PATCH, DELETE - x-iplb-instance: '32684' - body: - encoding: UTF-8 - file: no - string: '{"id":181,"date":"2020-04-01T00:00:00","date_gmt":"2020-03-31T22:00:00","guid":{"rendered":"https:\/\/rmd-wordpress.eu\/?p=181","raw":"https:\/\/rmd-wordpress.eu\/?p=181"},"modified":"2020-06-20T08:54:05","modified_gmt":"2020-06-20T06:54:05","password":"","slug":"post-rmd-2","status":"publish","type":"post","link":"https:\/\/rmd-wordpress.eu\/post-rmd-2\/","title":{"raw":"yay - rmd","rendered":"yay rmd"},"content":{"raw":"

        R Markdown<\/h2>\n

        A - citation1<\/sup><\/a>. - R is cool2<\/sup><\/a>.<\/p>\n

        This - is an R Markdown document. Markdown is a simple formatting syntax for authoring - HTML, PDF, and MS Word documents. For more details on using R Markdown see - http:\/\/rmarkdown.rstudio.com<\/a>.<\/p>\n

        When - you click the Knit<\/strong> button a document will be generated that - includes both content as well as the output of any embedded R code chunks - within the document. You can embed an R code chunk like this:<\/p>\n

        \n
        summary<\/a><\/span>(cars<\/span>)\n#>      speed           dist       <\/span>\n#>  Min.   : 4.0   Min.   :  2.00  <\/span>\n#>  1st
        -        Qu.:12.0   1st Qu.: 26.00  <\/span>\n#>  Median :15.0   Median
        -        : 36.00  <\/span>\n#>  Mean   :15.4   Mean   : 42.98  <\/span>\n#>  3rd Qu.:19.0   3rd Qu.: 56.00  <\/span>\n#>  Max.   :25.0   Max.   :120.00<\/span><\/code><\/pre>\n<\/div>\n

        Including Plots<\/h2>\n

        You can also embed plots, - for example:<\/p>\n

        \n

        <\/p>\n<\/div>\n

        Note - that the echo = FALSE<\/code> parameter was added to the code chunk - to prevent printing of the R code that generated the plot.<\/p>\n

        Another - plot<\/h2>\n
        \n
        plot<\/a><\/span>(1<\/span>:<\/span>10<\/span>,
        -        col = 3<\/span>)\n<\/code><\/pre>\n

        <\/p>\n<\/div>\n

        Some other thing<\/h2>\n
        \n
        sqrt<\/a><\/span>(4<\/span>)\n#> [1] 2<\/span><\/code><\/pre>\n<\/div>\n
        \n
        \n
          \n
        1. Rich FitzJohn et al., Jqr: Client for \u2018Jq\u2019, a \u2018Json\u2019 Processor<\/em>, 2018, https:\/\/CRAN.R-project.org\/package=jqr<\/a>.https:\/\/www.R-project.org\/<\/a>.\u21a9\ufe0e<\/a><\/p>\n<\/li>\n<\/ol>\n<\/div>\n","protected":false,"block_version":0},"excerpt":{"raw":"Here I summarize this fantastic post","rendered":"

          Here I summarize this fantastic - post<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"permalink_template":"https:\/\/rmd-wordpress.eu\/%postname%\/","generated_slug":"yay-rmd","_links":{"self":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"collection":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/comments?post=181"}],"version-history":[{"count":1,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181\/revisions"}],"predecessor-version":[{"id":182,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181\/revisions\/182"}],"wp:attachment":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/media?parent=181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/categories?post=181"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/tags?post=181"}],"wp:action-publish":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-unfiltered-html":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-sticky":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-assign-author":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-create-categories":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-assign-categories":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-create-tags":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-assign-tags":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}' - recorded_at: 2020-06-20 06:54:07 GMT + post<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"permalink_template":"https:\/\/rmd-wordpress.eu\/%postname%\/","generated_slug":"my-new-rmd-blog-post","_links":{"self":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/189"}],"collection":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/comments?post=189"}],"version-history":[{"count":0,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/189\/revisions"}],"wp:attachment":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/media?parent=189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/categories?post=189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/tags?post=189"}],"wp:action-publish":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/189"}],"wp:action-unfiltered-html":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/189"}],"wp:action-sticky":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/189"}],"wp:action-assign-author":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/189"}],"wp:action-create-categories":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/189"}],"wp:action-assign-categories":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/189"}],"wp:action-create-tags":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/189"}],"wp:action-assign-tags":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}' + recorded_at: 2020-06-20 11:50:27 GMT recorded_with: vcr/0.4.2.93, webmockr/0.6.2.92 - request: - method: post - uri: https://rmd-wordpress.eu/wp-json/wp/v2/posts/181 + method: get + uri: https://rmd-wordpress.eu/wp-json/wp/v2/media?parent=189 body: encoding: '' - string: '{"date":"2020-04-01T00:00:00","title":"yay rmd","slug":"post-rmd","status":"draft","content":"

          R Markdown<\/h2>\n

          A citation1<\/sup><\/a>. R is cool2<\/sup><\/a>.<\/p>\n

          This is an R Markdown document. - Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word - documents. For more details on using R Markdown see http://rmarkdown.rstudio.com<\/a>.<\/p>\n

          When you click the - Knit<\/strong> button a document will be generated that includes both - content as well as the output of any embedded R code chunks within the document. - You can embed an R code chunk like this:<\/p>\n

          \n
          summary<\/a><\/span>(cars<\/span>)\n#>      speed           dist       <\/span>\n#>  Min.   :
          -        4.0   Min.   :  2.00  <\/span>\n#>  1st Qu.:12.0   1st
          -        Qu.: 26.00  <\/span>\n#>  Median :15.0   Median : 36.00  <\/span>\n#>  Mean   :15.4   Mean   : 42.98  <\/span>\n#>  3rd
          -        Qu.:19.0   3rd Qu.: 56.00  <\/span>\n#>  Max.   :25.0   Max.   :120.00<\/span><\/code><\/pre>\n<\/div>\n

          Including Plots<\/h2>\n

          You can also embed plots, - for example:<\/p>\n

          \n

          <\/p>\n<\/div>\n

          Note - that the echo = FALSE<\/code> parameter was added to the code chunk - to prevent printing of the R code that generated the plot.<\/p>\n

          Another - plot<\/h2>\n
          \n
          plot<\/a><\/span>(1<\/span>:<\/span>10<\/span>,
          -        col = 3<\/span>)\n<\/code><\/pre>\n

          <\/p>\n<\/div>\n

          Some other thing<\/h2>\n
          \n
          sqrt<\/a><\/span>(4<\/span>)\n#> [1] 2<\/span><\/code><\/pre>\n<\/div>\n
          \n
          \n
            \n
          1. Rich FitzJohn et al., Jqr: Client for ‘Jq’, - a ‘Json’ Processor<\/em>, 2018, https://CRAN.R-project.org/package=jqr<\/a>.↩︎<\/a><\/p><\/li>\n

          2. R Core Team, - R: A Language and Environment for Statistical Computing<\/em> (Vienna, - Austria: R Foundation for Statistical Computing, 2020), https://www.R-project.org/<\/a>.↩︎<\/a><\/p><\/li>\n<\/ol>\n<\/div>","excerpt":"Here - I summarize this fantastic post","format":"standard"}' + string: '' headers: Accept: application/json, text/xml, application/xml, */* Authorization: Basic bWFlbGxlLW5vdC1hZG1pbjo3M1pPIEpnUTUgOVdsUSA3am51IFJBMlggeWRQeA== @@ -364,7 +173,7 @@ http_interactions: reason: OK message: 'Success: (200) OK' headers: - date: Sat, 20 Jun 2020 06:54:06 GMT + date: Sat, 20 Jun 2020 11:50:27 GMT content-type: application/json; charset=UTF-8 transfer-encoding: chunked connection: keep-alive @@ -377,148 +186,35 @@ http_interactions: access-control-allow-headers: Authorization, Content-Type expires: Wed, 11 Jan 1984 05:00:00 GMT cache-control: no-cache, must-revalidate, max-age=0 - allow: GET, POST, PUT, PATCH, DELETE - x-iplb-instance: '32683' + x-wp-total: '0' + x-wp-totalpages: '0' + allow: GET, POST + x-iplb-instance: '32681' body: encoding: UTF-8 file: no - string: '{"id":181,"date":"2020-04-01T00:00:00","date_gmt":"2020-03-31T22:00:00","guid":{"rendered":"https:\/\/rmd-wordpress.eu\/?p=181","raw":"https:\/\/rmd-wordpress.eu\/?p=181"},"modified":"2020-06-20T08:54:06","modified_gmt":"2020-06-20T06:54:06","password":"","slug":"post-rmd","status":"draft","type":"post","link":"https:\/\/rmd-wordpress.eu\/?p=181","title":{"raw":"yay - rmd","rendered":"yay rmd"},"content":{"raw":"

            R Markdown<\/h2>\n

            A - citation1<\/sup><\/a>. - R is cool2<\/sup><\/a>.<\/p>\n

            This - is an R Markdown document. Markdown is a simple formatting syntax for authoring - HTML, PDF, and MS Word documents. For more details on using R Markdown see - http:\/\/rmarkdown.rstudio.com<\/a>.<\/p>\n

            When - you click the Knit<\/strong> button a document will be generated that - includes both content as well as the output of any embedded R code chunks - within the document. You can embed an R code chunk like this:<\/p>\n

            \n
            summary<\/a><\/span>(cars<\/span>)\n#>      speed           dist       <\/span>\n#>  Min.   : 4.0   Min.   :  2.00  <\/span>\n#>  1st
            -        Qu.:12.0   1st Qu.: 26.00  <\/span>\n#>  Median :15.0   Median
            -        : 36.00  <\/span>\n#>  Mean   :15.4   Mean   : 42.98  <\/span>\n#>  3rd Qu.:19.0   3rd Qu.: 56.00  <\/span>\n#>  Max.   :25.0   Max.   :120.00<\/span><\/code><\/pre>\n<\/div>\n

            Including Plots<\/h2>\n

            You can also embed plots, - for example:<\/p>\n

            \n

            <\/p>\n<\/div>\n

            Note - that the echo = FALSE<\/code> parameter was added to the code chunk - to prevent printing of the R code that generated the plot.<\/p>\n

            Another - plot<\/h2>\n
            \n
            plot<\/a><\/span>(1<\/span>:<\/span>10<\/span>,
            -        col = 3<\/span>)\n<\/code><\/pre>\n

            <\/p>\n<\/div>\n

            Some other thing<\/h2>\n
            \n
            sqrt<\/a><\/span>(4<\/span>)\n#> [1] 2<\/span><\/code><\/pre>\n<\/div>\n
            \n
            \n
              \n
            1. Rich FitzJohn et al., - Jqr: Client for \u2018Jq\u2019, a \u2018Json\u2019 Processor<\/em>, 2018, - https:\/\/CRAN.R-project.org\/package=jqr<\/a>.\u21a9\ufe0e<\/a><\/p><\/li>\n

            2. R Core Team, R: A Language and Environment for Statistical - Computing<\/em> (Vienna, Austria: R Foundation for Statistical Computing, - 2020), https:\/\/www.R-project.org\/<\/a>.\u21a9\ufe0e<\/a><\/p><\/li>\n<\/ol>\n<\/div>","rendered":"

              R Markdown<\/h2>\n

              A citation1<\/sup><\/a>. R is cool2<\/sup><\/a>.<\/p>\n

              This is an R Markdown document. - Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word - documents. For more details on using R Markdown see http:\/\/rmarkdown.rstudio.com<\/a>.<\/p>\n

              When you click - the Knit<\/strong> button a document will be generated that includes - both content as well as the output of any embedded R code chunks within the - document. You can embed an R code chunk like this:<\/p>\n

              \n
              summary<\/a><\/span>(cars<\/span>)\n#>      speed           dist       <\/span>\n#>  Min.   : 4.0   Min.   :  2.00  <\/span>\n#>  1st
              -        Qu.:12.0   1st Qu.: 26.00  <\/span>\n#>  Median :15.0   Median
              -        : 36.00  <\/span>\n#>  Mean   :15.4   Mean   : 42.98  <\/span>\n#>  3rd Qu.:19.0   3rd Qu.: 56.00  <\/span>\n#>  Max.   :25.0   Max.   :120.00<\/span><\/code><\/pre>\n<\/div>\n

              Including Plots<\/h2>\n

              You can also embed plots, - for example:<\/p>\n

              \n

              <\/p>\n<\/div>\n

              Note - that the echo = FALSE<\/code> parameter was added to the code chunk - to prevent printing of the R code that generated the plot.<\/p>\n

              Another - plot<\/h2>\n
              \n
              plot<\/a><\/span>(1<\/span>:<\/span>10<\/span>,
              -        col = 3<\/span>)\n<\/code><\/pre>\n

              <\/p>\n<\/div>\n

              Some other thing<\/h2>\n
              \n
              sqrt<\/a><\/span>(4<\/span>)\n#> [1] 2<\/span><\/code><\/pre>\n<\/div>\n
              \n
              \n
                \n
              1. \n

                Rich FitzJohn et - al., Jqr: Client for \u2018Jq\u2019, a \u2018Json\u2019 Processor<\/em>, - 2018, https:\/\/CRAN.R-project.org\/package=jqr<\/a>.\u21a9\ufe0e<\/a><\/p>\n<\/li>\n

              2. \n

                R Core Team, R: A Language and Environment for Statistical - Computing<\/em> (Vienna, Austria: R Foundation for Statistical Computing, - 2020), https:\/\/www.R-project.org\/<\/a>.\u21a9\ufe0e<\/a><\/p>\n<\/li>\n<\/ol>\n<\/div>\n","protected":false,"block_version":0},"excerpt":{"raw":"Here - I summarize this fantastic post","rendered":"

                Here I summarize this fantastic - post<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"permalink_template":"https:\/\/rmd-wordpress.eu\/%postname%\/","generated_slug":"yay-rmd","_links":{"self":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"collection":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/comments?post=181"}],"version-history":[{"count":1,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181\/revisions"}],"predecessor-version":[{"id":182,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181\/revisions\/182"}],"wp:attachment":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/media?parent=181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/categories?post=181"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/tags?post=181"}],"wp:action-publish":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-unfiltered-html":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-sticky":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-assign-author":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-create-categories":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-assign-categories":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-create-tags":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-assign-tags":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}' - recorded_at: 2020-06-20 06:54:07 GMT + string: '[]' + recorded_at: 2020-06-20 11:50:27 GMT recorded_with: vcr/0.4.2.93, webmockr/0.6.2.92 - request: method: post - uri: https://rmd-wordpress.eu/wp-json/wp/v2/posts/181 + uri: https://rmd-wordpress.eu/wp-json/wp/v2/media?post=189 body: encoding: '' - string: '{"date":"2020-04-01T00:00:00","title":"yay rmd","slug":"post-rmd","status":"publish","content":"

                R Markdown<\/h2>\n

                A citation1<\/sup><\/a>. R is cool2<\/sup><\/a>.<\/p>\n

                This is an R Markdown document. - Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word - documents. For more details on using R Markdown see http://rmarkdown.rstudio.com<\/a>.<\/p>\n

                When you click the - Knit<\/strong> button a document will be generated that includes both - content as well as the output of any embedded R code chunks within the document. - You can embed an R code chunk like this:<\/p>\n

                \n
                summary<\/a><\/span>(cars<\/span>)\n#>      speed           dist       <\/span>\n#>  Min.   :
                -        4.0   Min.   :  2.00  <\/span>\n#>  1st Qu.:12.0   1st
                -        Qu.: 26.00  <\/span>\n#>  Median :15.0   Median : 36.00  <\/span>\n#>  Mean   :15.4   Mean   : 42.98  <\/span>\n#>  3rd
                -        Qu.:19.0   3rd Qu.: 56.00  <\/span>\n#>  Max.   :25.0   Max.   :120.00<\/span><\/code><\/pre>\n<\/div>\n

                Including Plots<\/h2>\n

                You can also embed plots, - for example:<\/p>\n

                \n

                <\/p>\n<\/div>\n

                Note - that the echo = FALSE<\/code> parameter was added to the code chunk - to prevent printing of the R code that generated the plot.<\/p>\n

                Another - plot<\/h2>\n
                \n
                plot<\/a><\/span>(1<\/span>:<\/span>10<\/span>,
                -        col = 3<\/span>)\n<\/code><\/pre>\n

                <\/p>\n<\/div>\n

                Some other thing<\/h2>\n
                \n
                sqrt<\/a><\/span>(4<\/span>)\n#> [1] 2<\/span><\/code><\/pre>\n<\/div>\n
                \n
                \n
                  \n
                1. Rich FitzJohn et al., Jqr: Client for ‘Jq’, - a ‘Json’ Processor<\/em>, 2018, https://CRAN.R-project.org/package=jqr<\/a>.↩︎<\/a><\/p><\/li>\n

                2. R Core Team, - R: A Language and Environment for Statistical Computing<\/em> (Vienna, - Austria: R Foundation for Statistical Computing, 2020), https://www.R-project.org/<\/a>.↩︎<\/a><\/p><\/li>\n<\/ol>\n<\/div>","excerpt":"Here - I summarize this fantastic post","format":"standard"}' + string: 'upload, file size: 15614' headers: Accept: application/json, text/xml, application/xml, */* + Content-Type: image/png Authorization: Basic bWFlbGxlLW5vdC1hZG1pbjo3M1pPIEpnUTUgOVdsUSA3am51IFJBMlggeWRQeA== - Content-Type: application/json + Content-Disposition: form-data; filename="pressure-1.png" response: status: - status_code: 200 - category: Success - reason: OK - message: 'Success: (200) OK' + status_code: 500 + category: Server error + reason: Internal Server Error + message: 'Server error: (500) Internal Server Error' headers: - date: Sat, 20 Jun 2020 06:54:07 GMT + date: Sat, 20 Jun 2020 11:50:27 GMT content-type: application/json; charset=UTF-8 transfer-encoding: chunked connection: keep-alive @@ -531,89 +227,12 @@ http_interactions: access-control-allow-headers: Authorization, Content-Type expires: Wed, 11 Jan 1984 05:00:00 GMT cache-control: no-cache, must-revalidate, max-age=0 - allow: GET, POST, PUT, PATCH, DELETE + allow: GET, POST x-iplb-instance: '32684' body: encoding: UTF-8 file: no - string: '{"id":181,"date":"2020-04-01T00:00:00","date_gmt":"2020-03-31T22:00:00","guid":{"rendered":"https:\/\/rmd-wordpress.eu\/?p=181","raw":"https:\/\/rmd-wordpress.eu\/?p=181"},"modified":"2020-06-20T08:54:07","modified_gmt":"2020-06-20T06:54:07","password":"","slug":"post-rmd-2","status":"publish","type":"post","link":"https:\/\/rmd-wordpress.eu\/post-rmd-2\/","title":{"raw":"yay - rmd","rendered":"yay rmd"},"content":{"raw":"

                  R Markdown<\/h2>\n

                  A - citation1<\/sup><\/a>. - R is cool2<\/sup><\/a>.<\/p>\n

                  This - is an R Markdown document. Markdown is a simple formatting syntax for authoring - HTML, PDF, and MS Word documents. For more details on using R Markdown see - http:\/\/rmarkdown.rstudio.com<\/a>.<\/p>\n

                  When - you click the Knit<\/strong> button a document will be generated that - includes both content as well as the output of any embedded R code chunks - within the document. You can embed an R code chunk like this:<\/p>\n

                  \n
                  summary<\/a><\/span>(cars<\/span>)\n#>      speed           dist       <\/span>\n#>  Min.   : 4.0   Min.   :  2.00  <\/span>\n#>  1st
                  -        Qu.:12.0   1st Qu.: 26.00  <\/span>\n#>  Median :15.0   Median
                  -        : 36.00  <\/span>\n#>  Mean   :15.4   Mean   : 42.98  <\/span>\n#>  3rd Qu.:19.0   3rd Qu.: 56.00  <\/span>\n#>  Max.   :25.0   Max.   :120.00<\/span><\/code><\/pre>\n<\/div>\n

                  Including Plots<\/h2>\n

                  You can also embed plots, - for example:<\/p>\n

                  \n

                  <\/p>\n<\/div>\n

                  Note - that the echo = FALSE<\/code> parameter was added to the code chunk - to prevent printing of the R code that generated the plot.<\/p>\n

                  Another - plot<\/h2>\n
                  \n
                  plot<\/a><\/span>(1<\/span>:<\/span>10<\/span>,
                  -        col = 3<\/span>)\n<\/code><\/pre>\n

                  <\/p>\n<\/div>\n

                  Some other thing<\/h2>\n
                  \n
                  sqrt<\/a><\/span>(4<\/span>)\n#> [1] 2<\/span><\/code><\/pre>\n<\/div>\n
                  \n
                  \n
                    \n
                  1. Rich FitzJohn et al., - Jqr: Client for \u2018Jq\u2019, a \u2018Json\u2019 Processor<\/em>, 2018, - https:\/\/CRAN.R-project.org\/package=jqr<\/a>.\u21a9\ufe0e<\/a><\/p><\/li>\n

                  2. R Core Team, R: A Language and Environment for Statistical - Computing<\/em> (Vienna, Austria: R Foundation for Statistical Computing, - 2020), https:\/\/www.R-project.org\/<\/a>.\u21a9\ufe0e<\/a><\/p><\/li>\n<\/ol>\n<\/div>","rendered":"

                    R Markdown<\/h2>\n

                    A citation1<\/sup><\/a>. R is cool2<\/sup><\/a>.<\/p>\n

                    This is an R Markdown document. - Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word - documents. For more details on using R Markdown see http:\/\/rmarkdown.rstudio.com<\/a>.<\/p>\n

                    When you click - the Knit<\/strong> button a document will be generated that includes - both content as well as the output of any embedded R code chunks within the - document. You can embed an R code chunk like this:<\/p>\n

                    \n
                    summary<\/a><\/span>(cars<\/span>)\n#>      speed           dist       <\/span>\n#>  Min.   : 4.0   Min.   :  2.00  <\/span>\n#>  1st
                    -        Qu.:12.0   1st Qu.: 26.00  <\/span>\n#>  Median :15.0   Median
                    -        : 36.00  <\/span>\n#>  Mean   :15.4   Mean   : 42.98  <\/span>\n#>  3rd Qu.:19.0   3rd Qu.: 56.00  <\/span>\n#>  Max.   :25.0   Max.   :120.00<\/span><\/code><\/pre>\n<\/div>\n

                    Including Plots<\/h2>\n

                    You can also embed plots, - for example:<\/p>\n

                    \n

                    <\/p>\n<\/div>\n

                    Note - that the echo = FALSE<\/code> parameter was added to the code chunk - to prevent printing of the R code that generated the plot.<\/p>\n

                    Another - plot<\/h2>\n
                    \n
                    plot<\/a><\/span>(1<\/span>:<\/span>10<\/span>,
                    -        col = 3<\/span>)\n<\/code><\/pre>\n

                    <\/p>\n<\/div>\n

                    Some other thing<\/h2>\n
                    \n
                    sqrt<\/a><\/span>(4<\/span>)\n#> [1] 2<\/span><\/code><\/pre>\n<\/div>\n
                    \n
                    \n
                      \n
                    1. \n

                      Rich FitzJohn et - al., Jqr: Client for \u2018Jq\u2019, a \u2018Json\u2019 Processor<\/em>, - 2018, https:\/\/CRAN.R-project.org\/package=jqr<\/a>.\u21a9\ufe0e<\/a><\/p>\n<\/li>\n

                    2. \n

                      R Core Team, R: A Language and Environment for Statistical - Computing<\/em> (Vienna, Austria: R Foundation for Statistical Computing, - 2020), https:\/\/www.R-project.org\/<\/a>.\u21a9\ufe0e<\/a><\/p>\n<\/li>\n<\/ol>\n<\/div>\n","protected":false,"block_version":0},"excerpt":{"raw":"Here - I summarize this fantastic post","rendered":"

                      Here I summarize this fantastic - post<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"permalink_template":"https:\/\/rmd-wordpress.eu\/%postname%\/","generated_slug":"yay-rmd","_links":{"self":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"collection":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/comments?post=181"}],"version-history":[{"count":1,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181\/revisions"}],"predecessor-version":[{"id":182,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181\/revisions\/182"}],"wp:attachment":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/media?parent=181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/categories?post=181"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/tags?post=181"}],"wp:action-publish":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-unfiltered-html":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-sticky":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-assign-author":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-create-categories":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-assign-categories":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-create-tags":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"wp:action-assign-tags":[{"href":"https:\/\/rmd-wordpress.eu\/wp-json\/wp\/v2\/posts\/181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}' - recorded_at: 2020-06-20 06:54:07 GMT + string: '{"code":"rest_upload_sideload_error","message":"Sorry, this file type + is not permitted for security reasons.","data":{"status":500}}' + recorded_at: 2020-06-20 11:50:27 GMT recorded_with: vcr/0.4.2.93, webmockr/0.6.2.92 diff --git a/tests/testthat/test-wp_post.R b/tests/testthat/test-wp_post.R index cb8d120..75da55e 100644 --- a/tests/testthat/test-wp_post.R +++ b/tests/testthat/test-wp_post.R @@ -5,7 +5,11 @@ test_that("wp_post works", { post_folder <- system.file(file.path("post-example2"), package = "goodpress") tmp_post_folder <- file.path(tempdir(), "post") dir.create(tmp_post_folder) - file.copy(dir(post_folder, full.names = TRUE), tmp_post_folder) + file.copy( + dir(post_folder, full.names = TRUE), + tmp_post_folder, + recursive = TRUE + ) # Just test that... we don't get errors :-s x <- wp_post(tmp_post_folder,