def test_checkout_libraries(self, mock_lib_refs):
        program = MbedProgram(None, MbedProgramFiles(None, pathlib.Path(),
                                                     None),
                              MbedOS(pathlib.Path(), None))
        program.checkout_libraries()

        program.lib_references.checkout.assert_called_once()
    def test_checks_for_unresolved_libraries(self, fs):
        root = pathlib.Path(fs, "root")
        make_mbed_lib_reference(root, resolved=True, ref_url="https://blah")
        make_mbed_lib_reference(root,
                                name="my-unresolved-lib.lib",
                                resolved=False,
                                ref_url="https://blah")
        mbed_os_root = root / "mbed-os"
        mbed_os_root.mkdir()

        program = MbedProgram(
            None, MbedProgramFiles(None, pathlib.Path(root / ".mbed"), None),
            MbedOS(mbed_os_root, None))
        self.assertTrue(program.has_unresolved_libraries())
    def test_lists_all_known_libraries(self, fs):
        root = pathlib.Path(fs, "root")
        lib_ref = make_mbed_lib_reference(root,
                                          resolved=True,
                                          ref_url="https://blah")
        lib_ref_unresolved = make_mbed_lib_reference(
            root,
            name="my-unresolved-lib.lib",
            resolved=False,
            ref_url="https://blah")
        mbed_os_root = root / "mbed-os"
        mbed_os_root.mkdir()

        program = MbedProgram(
            None, MbedProgramFiles(None, pathlib.Path(root, ".mbed"), None),
            MbedOS(mbed_os_root, None))
        libs = program.list_known_library_dependencies()
        self.assertEqual(str(lib_ref_unresolved), str(libs[0]))
        self.assertEqual(str(lib_ref), str(libs[1]))