@@ -832,7 +832,13 @@ pub(crate) async fn static_asset_handler(
832
832
833
833
#[ cfg( test) ]
834
834
mod test {
835
- use crate :: { test:: * , utils:: Dependency , web:: cache:: CachePolicy , Config } ;
835
+ use crate :: {
836
+ registry_api:: { CrateOwner , OwnerKind } ,
837
+ test:: * ,
838
+ utils:: Dependency ,
839
+ web:: cache:: CachePolicy ,
840
+ Config ,
841
+ } ;
836
842
use anyhow:: Context ;
837
843
use kuchikiki:: traits:: TendrilSink ;
838
844
use reqwest:: { blocking:: ClientBuilder , redirect, StatusCode } ;
@@ -2315,6 +2321,60 @@ mod test {
2315
2321
} )
2316
2322
}
2317
2323
2324
+ #[ test]
2325
+ fn test_owner_links_with_team ( ) {
2326
+ wrapper ( |env| {
2327
+ env. fake_release ( )
2328
+ . name ( "testing" )
2329
+ . version ( "0.1.0" )
2330
+ . add_owner ( CrateOwner {
2331
+ login : "some-user" . into ( ) ,
2332
+ kind : OwnerKind :: User ,
2333
+ avatar : "" . into ( ) ,
2334
+ } )
2335
+ . add_owner ( CrateOwner {
2336
+ login : "some-team" . into ( ) ,
2337
+ kind : OwnerKind :: Team ,
2338
+ avatar : "" . into ( ) ,
2339
+ } )
2340
+ . create ( ) ?;
2341
+
2342
+ let dom = kuchikiki:: parse_html ( ) . one (
2343
+ env. frontend ( )
2344
+ . get ( "/testing/0.1.0/testing/" )
2345
+ . send ( ) ?
2346
+ . text ( ) ?,
2347
+ ) ;
2348
+
2349
+ let owner_links: Vec < _ > = dom
2350
+ . select ( r#"#topbar-owners > li > a"# )
2351
+ . expect ( "invalid selector" )
2352
+ . map ( |el| {
2353
+ let attributes = el. attributes . borrow ( ) ;
2354
+ let url = attributes. get ( "href" ) . expect ( "href" ) . trim ( ) . to_string ( ) ;
2355
+ let name = el. text_contents ( ) . trim ( ) . to_string ( ) ;
2356
+ ( name, url)
2357
+ } )
2358
+ . collect ( ) ;
2359
+
2360
+ assert_eq ! (
2361
+ owner_links,
2362
+ vec![
2363
+ (
2364
+ "some-user" . into( ) ,
2365
+ "https://crates.io/users/some-user" . into( )
2366
+ ) ,
2367
+ (
2368
+ "some-team" . into( ) ,
2369
+ "https://crates.io/teams/some-team" . into( )
2370
+ ) ,
2371
+ ]
2372
+ ) ;
2373
+
2374
+ Ok ( ( ) )
2375
+ } )
2376
+ }
2377
+
2318
2378
#[ test]
2319
2379
fn test_dependency_optional_suffix ( ) {
2320
2380
wrapper ( |env| {
0 commit comments