From da228712d18904fa46825087c7791fb5bc581736 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Wed, 22 May 2019 20:13:19 -0400 Subject: [PATCH 1/2] Clarify test names --- .../http-data/{krate_yank => krate_yank_works_as_intended} | 0 src/tests/krate.rs | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename src/tests/http-data/{krate_yank => krate_yank_works_as_intended} (100%) diff --git a/src/tests/http-data/krate_yank b/src/tests/http-data/krate_yank_works_as_intended similarity index 100% rename from src/tests/http-data/krate_yank rename to src/tests/http-data/krate_yank_works_as_intended diff --git a/src/tests/krate.rs b/src/tests/krate.rs index efcf11c6d4f..c4ddc5fa24d 100644 --- a/src/tests/krate.rs +++ b/src/tests/krate.rs @@ -1386,7 +1386,7 @@ fn following() { } #[test] -fn yank() { +fn yank_works_as_intended() { let (app, anon, _, token) = TestApp::full().with_token(); // Upload a new crate, putting it in the git index @@ -1424,7 +1424,7 @@ fn yank() { } #[test] -fn yank_not_owner() { +fn yank_by_a_non_owner_fails() { let (app, _, _, token) = TestApp::full().with_token(); let another_user = app.db_new_user("bar"); From b1b77920ef6cc7160d228196220d7c9099435806 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Wed, 22 May 2019 20:24:56 -0400 Subject: [PATCH 2/2] Fix the test setup to create the version we're trying to yank This makes the error returned what we're really trying to test for --- src/tests/krate.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tests/krate.rs b/src/tests/krate.rs index c4ddc5fa24d..0d8650cddf8 100644 --- a/src/tests/krate.rs +++ b/src/tests/krate.rs @@ -1430,13 +1430,15 @@ fn yank_by_a_non_owner_fails() { let another_user = app.db_new_user("bar"); let another_user = another_user.as_model(); app.db(|conn| { - CrateBuilder::new("foo_not", another_user.id).expect_build(conn); + CrateBuilder::new("foo_not", another_user.id) + .version("1.0.0") + .expect_build(conn); }); let json = token.yank("foo_not", "1.0.0").bad_with_status(200); assert_eq!( json.errors[0].detail, - "crate `foo_not` does not have a version `1.0.0`" + "must already be an owner to yank or unyank" ); }