blob: 05b3b1976e23d778d76533f095eef6509a5b01a8 [file] [log] [blame]
#!/usr/bin/env fuchsia-vendored-python
# Copyright 2021 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import tempfile
import unittest
from unittest import mock
import gen_helpdocs
class GenReferenceDocsTest(unittest.TestCase):
def setUp(self):
# Create a temporary directory
self.temp_dir = tempfile.mkdtemp()
def test_run_helpdocs(self):
out_path = os.path.join(self.temp_dir, 'gen', 'test.tar.gz')
src_dir = os.path.join(self.temp_dir, 'scripts')
depfile = os.path.join(self.temp_dir, 'depfile')
fx_bin = os.path.join(src_dir, "scripts/fx")
with mock.patch.object(gen_helpdocs.subprocess, 'run') as mock_run:
gen_helpdocs.run_fx_helpdoc(src_dir, out_path)
mock_run.assert_called_once_with(
[fx_bin, "helpdoc", "--depfile", depfile, "--archive", out_path])