Page MenuHomeDevCentral

Upgrade mockito code to 1.x
Closed, ResolvedPublic

Description

The crate mockito seems to have a rather fast paced development for deprecation cycle,
as code from January is already broken if we want to upgrade from 0.x to 1.x.

Migration guide

This task has been identified as suitable to discover our codebase.

Version 0.32.5 :: Deprecations

$ cargo test
    Updating crates.io index
  Downloaded mockito v0.32.5
  Downloaded 1 crate (43.0 KB) in 0.39s
   Compiling mockito v0.32.5
   Compiling opendatasoft-explore-api v0.1.0 (.../dev/nasqueron/datasources/opendatasoft-explore-api)
warning: use of deprecated function `mockito::mock`: Use `Server::mock` instead
 --> opendatasoft-explore-api/tests/requests_test.rs:6:15
  |
6 | use mockito::{mock, Mock};
  |               ^^^^
  |
  = note: `#[warn(deprecated)]` on by default

warning: use of deprecated function `mockito::server_url`: Use `Server::url` instead
  --> opendatasoft-explore-api/tests/requests_test.rs:19:44
   |
19 |     static ref MOCK_URL: String = mockito::server_url();
   |                                            ^^^^^^^^^^

warning: use of deprecated function `mockito::mock`: Use `Server::mock` instead
  --> opendatasoft-explore-api/tests/requests_test.rs:36:5
   |
36 |     mock("GET", url)
   |     ^^^^

warning: `opendatasoft-explore-api` (test "requests_test") generated 3 warnings
    Finished test [unoptimized + debuginfo] target(s) in 5.28s
     Running unittests src/main.rs (target/debug/deps/fantoir_datasource-d62d3abe561d95fe)

Version 1.0 :: It has been deprecated

$ cargo test
   Compiling atty v0.2.14
   Compiling assert-json-diff v2.0.2
   Compiling similar v2.2.1
   Compiling fantoir-datasource v0.1.0 (/.../dev/nasqueron/datasources/fantoir-datasource)                                                                                                                          Compiling colored v2.0.0
   Compiling mockito v1.0.2
   Compiling opendatasoft-explore-api v0.1.0 (.../dev/nasqueron/datasources/opendatasoft-explore-api)
error[E0425]: cannot find function `server_url` in crate `mockito`
  --> opendatasoft-explore-api/tests/requests_test.rs:19:44
   |
19 |     static ref MOCK_URL: String = mockito::server_url();
   |                                            ^^^^^^^^^^ not found in `mockito`

error[E0603]: module `mock` is private
   --> opendatasoft-explore-api/tests/requests_test.rs:6:15
    |
6   | use mockito::{mock, Mock};
    |               ^^^^ private module
    |
note: the module `mock` is defined here
   --> .../.cargo/registry/src/github.com-1ecc6299db9ec823/mockito-1.0.2/src/lib.rs:683:1
    |
683 | mod mock;
    | ^^^^^^^^

Event Timeline

dereckson created this task.
dereckson added a project: Technical debt.
dereckson renamed this task from Upgrade mockito code to Upgrade mockito code to 1.x.May 27 2023, 18:54
dereckson updated the task description. (Show Details)
dereckson added a project: good-first-issue.
dereckson moved this task from Backlog to Dev on the good-first-issue board.

Hi!

I want to work on this issue. I have worked with Rust before, and it seems like a good place to start contributing to Nasqueron.
This is my first time on Devcentral (I have previously worked on GitHub only). So, can anyone also link me to a beginner's guide so that I can figure out how to see the project's source code and set it up locally?

Hi!

There is a guide / mémento available at https://agora.nasqueron.org/How_to_contribute_code - it explains how to clone the repository and send the code to review, the equivalent of pull request.

The repository to clone is this one: rDS - the green clone button gives the http or ssh URL

Thanks @dereckson! I cloned, made some changes locally, and then ran the arc diff command after committing them to a new branch. I tried opening the differentials page but couldn't find anything specific to my changes there. Can you let me know how do I have to get them reviewed?

Edit: Never mind, I figured it out. It's at https://devcentral.nasqueron.org/D3244. Hoping to see your review.

dereckson assigned this task to EshaanAgg.

Code merged, thanks for the contribution :)