Fix to use mkstemp for temp shadow file creation

Do not rely on randomString() for tempShadowFile, as it uses '/' in random
set, and cause file creation error. Also, it's safe to use mkstemp to create
temp shadow file with random name suffixing shadow file name.

Change-Id: I0b80cc6d7c002e732e22f660e50b0701acac15fe
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
diff --git a/test/utest.cpp b/test/utest.cpp
index bdca968..33e0576 100644
--- a/test/utest.cpp
+++ b/test/utest.cpp
@@ -14,7 +14,6 @@
 
 constexpr auto path = "/dummy/user";
 constexpr auto testShadow = "/tmp/__tshadow__";
-constexpr auto shadowCopy = "/tmp/__tshadowCopy__";
 constexpr auto shadowCompare = "/tmp/__tshadowCompare__";
 
 // New password
@@ -64,11 +63,6 @@
                 fs::remove(testShadow);
             }
 
-            if (fs::exists(shadowCopy))
-            {
-                fs::remove(shadowCopy);
-            }
-
             if (fs::exists(shadowCompare))
             {
                 fs::remove(shadowCompare);
@@ -103,8 +97,7 @@
         /** @brief Applies the new password */
         auto applyPassword()
         {
-            return user.applyPassword(testShadow, shadowCopy,
-                                      password, salt);
+            return user.applyPassword(testShadow, password, salt);
         }
 };
 
@@ -168,22 +161,6 @@
     EXPECT_EQ(shadowEntry, shadowCompareEntry);
 }
 
-/** @brief Verifies the shadow copy file is removed
- */
-TEST_F(UserTest, checkShadowCopyRemove)
-{
-    // Update the password so that the temp file is in action
-    applyPassword();
-
-    // Compare the permission of 2 files
-    struct stat shadow{};
-    struct stat temp{};
-
-    stat(testShadow, &shadow);
-    stat(shadowCopy, &temp);
-    EXPECT_EQ(false, fs::exists(shadowCopy));
-}
-
 /** @brief Verifies the permissions are correct
  */
 TEST_F(UserTest, verifyShadowPermission)