@@ -4,7 +4,7 @@ use crate::consts::{DAV_XML_CONTENT_TYPE, YAML_CONTENT_TYPE};
4
4
use axum:: body:: Bytes ;
5
5
use http_body_util:: BodyExt ; // for `collect`
6
6
use indoc:: indoc;
7
- use testutils:: { CollectionEntry , CollectionPage , Link , Resource , Trinary } ;
7
+ use testutils:: { CollectionEntry , CollectionPage , Link , Resource , ResourceProps , Trinary } ;
8
8
use tower:: { Service , ServiceExt } ; // for `ready`
9
9
10
10
fn fill_html_footer ( html : & str ) -> String {
@@ -122,12 +122,10 @@ impl<'a> Propfinder<'a> {
122
122
}
123
123
}
124
124
125
- /*
126
125
fn body ( mut self , body : & ' static str ) -> Self {
127
126
self . body = Some ( body) ;
128
127
self
129
128
}
130
- */
131
129
132
130
fn depth ( mut self , depth : & ' static str ) -> Self {
133
131
self . depth = Some ( depth) ;
@@ -182,6 +180,11 @@ impl PropfindResponse {
182
180
testutils:: parse_propfind_response ( body) . unwrap ( )
183
181
}
184
182
183
+ fn into_propnames ( self ) -> Vec < ResourceProps > {
184
+ let body = std:: str:: from_utf8 ( self . 0 . body ( ) ) . unwrap ( ) ;
185
+ testutils:: parse_propname_response ( body) . unwrap ( )
186
+ }
187
+
185
188
fn assert_body ( self , expected : & str ) -> Self {
186
189
let body = std:: str:: from_utf8 ( self . 0 . body ( ) ) . unwrap ( ) ;
187
190
assert_eq ! ( body, expected) ;
@@ -1468,7 +1471,7 @@ async fn propfind_version_toplevel() {
1468
1471
href: "/dandisets/000001/releases/0.210512.1623/" . into( ) ,
1469
1472
creation_date: Trinary :: Set ( "2021-05-12T16:23:14.388489Z" . into( ) ) ,
1470
1473
display_name: Trinary :: Set ( "0.210512.1623" . into( ) ) ,
1471
- content_length: Trinary :: Set ( 42489179 , ) ,
1474
+ content_length: Trinary :: Set ( 42489179 ) ,
1472
1475
content_type: Trinary :: Void ,
1473
1476
last_modified: Trinary :: Set ( "Wed, 12 May 2021 16:23:19 GMT" . into( ) ) ,
1474
1477
etag: Trinary :: Void ,
@@ -1560,3 +1563,64 @@ async fn propfind_asset_folder() {
1560
1563
]
1561
1564
) ;
1562
1565
}
1566
+
1567
+ #[ tokio:: test]
1568
+ async fn propfind_propname ( ) {
1569
+ let mut app = MockApp :: new ( ) . await ;
1570
+ let props = app
1571
+ . propfind ( "/dandisets/000001/releases/0.210512.1623/" )
1572
+ . body ( r#"<?xml version="1.0" encoding="utf-8"?><propfind xmlns="DAV:"><propname /></propfind>"# )
1573
+ . send ( )
1574
+ . await
1575
+ . success ( )
1576
+ . into_propnames ( ) ;
1577
+ pretty_assertions:: assert_eq!(
1578
+ props,
1579
+ vec![
1580
+ ResourceProps {
1581
+ href: "/dandisets/000001/releases/0.210512.1623/" . into( ) ,
1582
+ creation_date: true ,
1583
+ display_name: true ,
1584
+ content_length: true ,
1585
+ content_type: false ,
1586
+ last_modified: true ,
1587
+ etag: false ,
1588
+ language: false ,
1589
+ resource_type: true ,
1590
+ } ,
1591
+ ResourceProps {
1592
+ href: "/dandisets/000001/releases/0.210512.1623/participants.tsv" . into( ) ,
1593
+ creation_date: true ,
1594
+ display_name: true ,
1595
+ content_length: true ,
1596
+ content_type: true ,
1597
+ last_modified: true ,
1598
+ etag: true ,
1599
+ language: false ,
1600
+ resource_type: true ,
1601
+ } ,
1602
+ ResourceProps {
1603
+ href: "/dandisets/000001/releases/0.210512.1623/sub-RAT123/" . into( ) ,
1604
+ creation_date: false ,
1605
+ display_name: true ,
1606
+ content_length: false ,
1607
+ content_type: false ,
1608
+ last_modified: false ,
1609
+ etag: false ,
1610
+ language: false ,
1611
+ resource_type: true ,
1612
+ } ,
1613
+ ResourceProps {
1614
+ href: "/dandisets/000001/releases/0.210512.1623/dandiset.yaml" . into( ) ,
1615
+ creation_date: false ,
1616
+ display_name: true ,
1617
+ content_length: true ,
1618
+ content_type: true ,
1619
+ last_modified: false ,
1620
+ etag: false ,
1621
+ language: false ,
1622
+ resource_type: true ,
1623
+ } ,
1624
+ ]
1625
+ ) ;
1626
+ }
0 commit comments