File tree Expand file tree Collapse file tree 2 files changed +27
-10
lines changed
Expand file tree Collapse file tree 2 files changed +27
-10
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ use crate::suite::client;
2525pub mod mutations;
2626pub mod queries;
2727
28- pub async fn run_test ( client : client:: EdgehogClient ) -> eyre:: Result < ( ) > {
28+ pub async fn test_image_credentials ( client : client:: EdgehogClient ) -> eyre:: Result < ( ) > {
2929 let username = Alphabetic . sample_string ( & mut rand:: rng ( ) , 5 ) ;
3030 let label = Alphabetic . sample_string ( & mut rand:: rng ( ) , 5 ) ;
3131 let password = Alphabetic . sample_string ( & mut rand:: rng ( ) , 10 ) ;
@@ -64,7 +64,5 @@ pub async fn run_test(client: client::EdgehogClient) -> eyre::Result<()> {
6464 assert_eq ! ( image_credentials. username, username) ;
6565 assert_eq ! ( image_credentials. label, label) ;
6666
67- println ! ( "[ PASSED ] image credentials tests" ) ;
68-
6967 Ok ( ( ) )
7068}
Original file line number Diff line number Diff line change 1919mod image_credentials;
2020mod suite;
2121
22- use clap:: Parser ;
23- use suite:: client:: EdgehogClient ;
24- use suite:: config:: Config ;
25-
2622#[ tokio:: main]
2723async fn main ( ) -> eyre:: Result < ( ) > {
28- let config = Config :: parse ( ) ;
29- let client = EdgehogClient :: create ( & config) ?;
30- image_credentials:: run_test ( client) . await
24+ Ok ( ( ) )
25+ }
26+
27+ #[ cfg( test) ]
28+ mod test {
29+ use super :: * ;
30+
31+ use suite:: client:: EdgehogClient ;
32+ use suite:: config:: Config ;
33+
34+ fn test_config ( ) -> Config {
35+ Config {
36+ hostname : "api.edgehog.localhost" . to_string ( ) ,
37+ scheme : "http" . to_string ( ) ,
38+ bearer : "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJlX3RnYSI6IioiLCJpYXQiOjE3Mzg5NDgzODh9.TTiXYs1LucAnS_6RGp7pWg-S30NSt7eqL7lU8BzT5BWlHctk7NYZwC6lftA6WeEb1HKEJfPoUqWeOeZ6oYA0AA" . to_string ( ) ,
39+ tenant : "test" . to_string ( )
40+ }
41+ }
42+
43+ #[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
44+ async fn image_credentials ( ) -> eyre:: Result < ( ) > {
45+ let config = test_config ( ) ;
46+
47+ let client = EdgehogClient :: create ( & config) ?;
48+ image_credentials:: test_image_credentials ( client) . await
49+ }
3150}
You can’t perform that action at this time.
0 commit comments