@@ -542,50 +542,24 @@ where
542542
543543#[ cfg( test) ]
544544mod tests {
545- use super :: * ;
546-
547- #[ test]
548- fn source_kind_oci ( ) {
549- let repo = ChartRepo {
550- name : "nifi-operator" . to_string ( ) ,
551- url : "oci://oci.stackable.tech/sdp-charts" . to_string ( ) ,
552- } ;
553- assert_eq ! ( repo. source_kind( ) , ChartSourceKind :: Oci ) ;
554- }
555-
556- #[ test]
557- fn source_kind_https_repo ( ) {
558- let repo = ChartRepo {
559- name : "stackable-stable" . to_string ( ) ,
560- url : "https://repo.stackable.tech/repository/helm-stable" . to_string ( ) ,
561- } ;
562- assert_eq ! ( repo. source_kind( ) , ChartSourceKind :: Repo ) ;
563- }
545+ use rstest:: rstest;
564546
565- #[ test]
566- fn source_kind_http_repo ( ) {
567- let repo = ChartRepo {
568- name : "example" . to_string ( ) ,
569- url : "http://example.com/charts" . to_string ( ) ,
570- } ;
571- assert_eq ! ( repo. source_kind( ) , ChartSourceKind :: Repo ) ;
572- }
573-
574- #[ test]
575- fn source_kind_relative_path_is_local ( ) {
576- let repo = ChartRepo {
577- name : "local" . to_string ( ) ,
578- url : "./charts/my-chart" . to_string ( ) ,
579- } ;
580- assert_eq ! ( repo. source_kind( ) , ChartSourceKind :: Local ) ;
581- }
547+ use super :: * ;
582548
583- #[ test]
584- fn source_kind_absolute_path_is_local ( ) {
549+ #[ rstest]
550+ #[ case( "oci://oci.stackable.tech/sdp-charts" , ChartSourceKind :: Oci ) ]
551+ #[ case(
552+ "https://repo.stackable.tech/repository/helm-stable" ,
553+ ChartSourceKind :: Repo
554+ ) ]
555+ #[ case( "http://example.com/charts" , ChartSourceKind :: Repo ) ]
556+ #[ case( "./charts/my-chart" , ChartSourceKind :: Local ) ]
557+ #[ case( "/absolute/path/to/chart" , ChartSourceKind :: Local ) ]
558+ fn source_kind ( #[ case] url : & str , #[ case] expected : ChartSourceKind ) {
585559 let repo = ChartRepo {
586- name : "local" . to_string ( ) ,
587- url : "/absolute/path/to/chart" . to_string ( ) ,
560+ name : "test" . to_owned ( ) ,
561+ url : url . to_owned ( ) ,
588562 } ;
589- assert_eq ! ( repo. source_kind( ) , ChartSourceKind :: Local ) ;
563+ assert_eq ! ( repo. source_kind( ) , expected ) ;
590564 }
591565}
0 commit comments