@@ -17,7 +17,7 @@ public void RFPEM_Inventory_InternalPrivateKey_EmptyStore_Linux_Test0001()
1717 {
1818 InventoryJobConfiguration config = BuildBaseInventoryConfig ( ) ;
1919 config . CertificateStoreDetails . ClientMachine = EnvironmentVariables . LinuxServer ;
20- config . CertificateStoreDetails . StorePath = EnvironmentVariables . LinuxStorePath ;
20+ config . CertificateStoreDetails . StorePath = EnvironmentVariables . LinuxStorePath + "Test0001.pem" ;
2121 config . CertificateStoreDetails . Properties = "{}" ;
2222 //config.CertificateStoreDetails.Properties = JsonConvert.SerializeObject(new Dictionary<string, string?>() { { "SeparatePrivateKeyFilePath", Environment.GetEnvironmentVariable("LinuxStorePath") + "Test0001.key" } });
2323 config . CertificateStoreDetails . ClientMachine = EnvironmentVariables . LinuxServer ;
@@ -31,6 +31,30 @@ public void RFPEM_Inventory_InternalPrivateKey_EmptyStore_Linux_Test0001()
3131
3232 Assert . Equal ( OrchestratorJobStatusJobResult . Success , result . Result ) ;
3333
34+ IInvocation invocation = submitInventoryUpdate . Invocations [ 0 ] ;
35+ List < CurrentInventoryItem > inventoryItems = ( List < CurrentInventoryItem > ) invocation . Arguments [ 0 ] ;
36+ Assert . Empty ( inventoryItems ) ;
37+ }
38+
39+ [ Fact ]
40+ public void RFPEM_Inventory_InternalPrivateKey_WithCert_Linux_Test0002 ( )
41+ {
42+ InventoryJobConfiguration config = BuildBaseInventoryConfig ( ) ;
43+ config . CertificateStoreDetails . ClientMachine = EnvironmentVariables . LinuxServer ;
44+ config . CertificateStoreDetails . StorePath = EnvironmentVariables . LinuxStorePath + "Test0002.pem" ;
45+ config . CertificateStoreDetails . Properties = "{}" ;
46+ //config.CertificateStoreDetails.Properties = JsonConvert.SerializeObject(new Dictionary<string, string?>() { { "SeparatePrivateKeyFilePath", Environment.GetEnvironmentVariable("LinuxStorePath") + "Test0001.key" } });
47+ config . CertificateStoreDetails . ClientMachine = EnvironmentVariables . LinuxServer ;
48+
49+ Mock < IPAMSecretResolver > secretResolver = GetMockSecretResolver ( config ) ;
50+
51+ Mock < SubmitInventoryUpdate > submitInventoryUpdate = new Mock < SubmitInventoryUpdate > ( ) ;
52+
53+ Inventory inventory = new Inventory ( secretResolver . Object ) ;
54+ JobResult result = inventory . ProcessJob ( config , submitInventoryUpdate . Object ) ;
55+
56+ Assert . Equal ( OrchestratorJobStatusJobResult . Success , result . Result ) ;
57+
3458 IInvocation invocation = submitInventoryUpdate . Invocations [ 0 ] ;
3559 List < CurrentInventoryItem > inventoryItems = ( List < CurrentInventoryItem > ) invocation . Arguments [ 0 ] ;
3660 Assert . Single ( inventoryItems ) ;
@@ -44,11 +68,12 @@ public void RFPEM_Inventory_InternalPrivateKey_EmptyStore_Linux_Test0001()
4468
4569 Assert . Equal ( EnvironmentVariables . CertificateSubjectDN , certificate . SubjectDN . ToString ( ) ) ;
4670 }
47-
4871 }
4972
5073 public override void SetUp ( )
5174 {
75+ CreateCertificateAndKey ( ) ;
76+
5277 CreateStore ( "Test0001" , false , false , STORE_ENVIRONMENT_ENUM . LINUX ) ;
5378 CreateStore ( "Test0002" , false , true , STORE_ENVIRONMENT_ENUM . LINUX ) ;
5479 CreateStore ( "Test0003" , true , false , STORE_ENVIRONMENT_ENUM . LINUX ) ;
0 commit comments