Skip to content

Commit ef5662a

Browse files
committed
Auto merge of #1753 - integer32llc:fix-yank-test, r=jtgeibel
Fix yank test This test wasn't set up correctly, so the error message that was being checked wasn't quite right. Also, [based on this comment](#1697 (comment)) it seems like the names of these tests weren't as descriptive as they could be-- the previous test covers the success case of an owner being able to yank, and the next text checks that nonowners aren't allowed to yank.
2 parents 687849c + b1b7792 commit ef5662a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/tests/krate.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,7 @@ fn following() {
13861386
}
13871387

13881388
#[test]
1389-
fn yank() {
1389+
fn yank_works_as_intended() {
13901390
let (app, anon, _, token) = TestApp::full().with_token();
13911391

13921392
// Upload a new crate, putting it in the git index
@@ -1424,19 +1424,21 @@ fn yank() {
14241424
}
14251425

14261426
#[test]
1427-
fn yank_not_owner() {
1427+
fn yank_by_a_non_owner_fails() {
14281428
let (app, _, _, token) = TestApp::full().with_token();
14291429

14301430
let another_user = app.db_new_user("bar");
14311431
let another_user = another_user.as_model();
14321432
app.db(|conn| {
1433-
CrateBuilder::new("foo_not", another_user.id).expect_build(conn);
1433+
CrateBuilder::new("foo_not", another_user.id)
1434+
.version("1.0.0")
1435+
.expect_build(conn);
14341436
});
14351437

14361438
let json = token.yank("foo_not", "1.0.0").bad_with_status(200);
14371439
assert_eq!(
14381440
json.errors[0].detail,
1439-
"crate `foo_not` does not have a version `1.0.0`"
1441+
"must already be an owner to yank or unyank"
14401442
);
14411443
}
14421444

0 commit comments

Comments
 (0)