@@ -26,17 +26,17 @@ START_TEST(test_gpg_check_signature)
2626
2727 tmp_home_path = lr_gettmpdir ();
2828 key_path = lr_pathconcat (test_globals .testdata_dir ,
29- "repo_yum_01/repodata/repomd.xml.key" , NULL );
29+ "repo_yum_01/repodata/repomd.xml.key.asc " , NULL );
3030 _key_path = lr_pathconcat (test_globals .testdata_dir ,
31- "repo_yum_01/repodata/repomd.xml_bad.key" , NULL );
31+ "repo_yum_01/repodata/repomd.xml_bad.key.asc " , NULL );
3232 data_path = lr_pathconcat (test_globals .testdata_dir ,
3333 "repo_yum_01/repodata/repomd.xml" , NULL );
3434 _data_path = lr_pathconcat (test_globals .testdata_dir ,
3535 "repo_yum_01/repodata/repomd.xml_bad" , NULL );
3636 signature_path = lr_pathconcat (test_globals .testdata_dir ,
3737 "repo_yum_01/repodata/repomd.xml.asc" , NULL );
3838 _signature_path = lr_pathconcat (test_globals .testdata_dir ,
39- "repo_yum_01/repodata/repomd.xml_bad.asc " , NULL );
39+ "repo_yum_01/repodata/repomd.xml_bad.sig " , NULL );
4040
4141 // Import the first key directly from the file
4242 ret = lr_gpg_import_key (key_path , tmp_home_path , & tmp_err );
@@ -124,16 +124,14 @@ START_TEST(test_gpg_check_signature)
124124}
125125END_TEST
126126
127- START_TEST (test_gpg_check_key_export )
127+
128+ static void check_key_import_test_export (const char * key_path )
128129{
129130 gboolean ret ;
130- char * key_path ;
131131 char * tmp_home_path ;
132132 GError * tmp_err = NULL ;
133133
134134 tmp_home_path = lr_gettmpdir ();
135- key_path = lr_pathconcat (test_globals .testdata_dir ,
136- "repo_yum_01/repodata/repomd.xml.key" , NULL );
137135
138136 // Import the key from file descriptor
139137 int key_fd = open (key_path , O_RDONLY );
@@ -227,9 +225,24 @@ START_TEST(test_gpg_check_key_export)
227225
228226 lr_gpg_keys_free (keys );
229227 lr_remove_dir (tmp_home_path );
230- lr_free (key_path );
231228 g_free (tmp_home_path );
232229}
230+
231+
232+ START_TEST (test_gpg_check_armored_key_import_test_export )
233+ {
234+ char * key_path = lr_pathconcat (test_globals .testdata_dir , "repo_yum_01/repodata/repomd.xml.key.asc" , NULL );
235+ check_key_import_test_export (key_path );
236+ lr_free (key_path );
237+ }
238+ END_TEST
239+
240+ START_TEST (test_gpg_check_binary_key_import_test_export )
241+ {
242+ char * key_path = lr_pathconcat (test_globals .testdata_dir , "repo_yum_01/repodata/repomd.xml.key" , NULL );
243+ check_key_import_test_export (key_path );
244+ lr_free (key_path );
245+ }
233246END_TEST
234247
235248
@@ -239,7 +252,8 @@ gpg_suite(void)
239252 Suite * s = suite_create ("gpg" );
240253 TCase * tc = tcase_create ("Main" );
241254 tcase_add_test (tc , test_gpg_check_signature );
242- tcase_add_test (tc , test_gpg_check_key_export );
255+ tcase_add_test (tc , test_gpg_check_armored_key_import_test_export );
256+ tcase_add_test (tc , test_gpg_check_binary_key_import_test_export );
243257 suite_add_tcase (s , tc );
244258 return s ;
245259}
0 commit comments