@@ -10,6 +10,7 @@ use diesel::{dsl::*, prelude::*, update};
10
10
mod dependencies;
11
11
mod downloads;
12
12
mod following;
13
+ mod owners;
13
14
mod publish;
14
15
mod reverse_dependencies;
15
16
mod show;
@@ -652,48 +653,6 @@ fn test_default_sort_recent() {
652
653
assert_eq ! ( json. crates[ 1 ] . downloads, 20 ) ;
653
654
}
654
655
655
- // This is testing Cargo functionality! ! !
656
- // specifically functions modify_owners and add_owners
657
- // which call the `PUT /crates/:crate_id/owners` route
658
- #[ test]
659
- fn test_cargo_invite_owners ( ) {
660
- let ( app, _, owner) = TestApp :: init ( ) . with_user ( ) ;
661
-
662
- let new_user = app. db_new_user ( "cilantro" ) ;
663
- app. db ( |conn| {
664
- CrateBuilder :: new ( "guacamole" , owner. as_model ( ) . id ) . expect_build ( conn) ;
665
- } ) ;
666
-
667
- #[ derive( Serialize ) ]
668
- struct OwnerReq {
669
- owners : Option < Vec < String > > ,
670
- }
671
- #[ derive( Deserialize , Debug ) ]
672
- struct OwnerResp {
673
- // server must include `ok: true` to support old cargo clients
674
- ok : bool ,
675
- msg : String ,
676
- }
677
-
678
- let body = serde_json:: to_string ( & OwnerReq {
679
- owners : Some ( vec ! [ new_user. as_model( ) . gh_login. clone( ) ] ) ,
680
- } ) ;
681
- let json: OwnerResp = owner
682
- . put ( "/api/v1/crates/guacamole/owners" , body. unwrap ( ) . as_bytes ( ) )
683
- . good ( ) ;
684
-
685
- // this ok:true field is what old versions of Cargo
686
- // need - do not remove unless you're cool with
687
- // dropping support for old versions
688
- assert ! ( json. ok) ;
689
- // msg field is what is sent and used in updated
690
- // version of cargo
691
- assert_eq ! (
692
- json. msg,
693
- "user cilantro has been invited to be an owner of crate guacamole"
694
- )
695
- }
696
-
697
656
#[ test]
698
657
fn pagination_links_included_if_applicable ( ) {
699
658
let ( app, anon, user) = TestApp :: init ( ) . with_user ( ) ;
0 commit comments