service: test: Use chroot_lib for path translation

BUG=b:191307774
TEST=./run_tests

Change-Id: I52cc8dee2996b33b0f063b8da3280623dbdbc30e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4661951
Tested-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Greg Edelston <gredelston@google.com>
Commit-Queue: Brian Norris <briannorris@chromium.org>
diff --git a/api/controller/test_unittest.py b/api/controller/test_unittest.py
index 543b666..bd30ce9 100644
--- a/api/controller/test_unittest.py
+++ b/api/controller/test_unittest.py
@@ -827,12 +827,15 @@
 
     def setUp(self):
         """Set up the class for tests."""
-        chroot_dir = os.path.join(self.tempdir, "chroot")
-        osutils.SafeMakedirs(chroot_dir)
-        osutils.SafeMakedirs(os.path.join(chroot_dir, "tmp"))
-        self.chroot = chroot_lib.Chroot(chroot_dir)
+        self.PatchObject(cros_build_lib, "IsInsideChroot", return_value=False)
 
-        sysroot_path = os.path.join(chroot_dir, "build", "board")
+        self.chroot = chroot_lib.Chroot(
+            path=self.tempdir / "chroot",
+            out_path=self.tempdir / "out",
+        )
+        osutils.SafeMakedirs(self.chroot.tmp)
+
+        sysroot_path = self.chroot.full_path("/build/board")
         osutils.SafeMakedirs(sysroot_path)
         self.sysroot = sysroot_lib.Sysroot(sysroot_path)