Ejemplo n.º 1
0
def test_find_devs_with_freebsd(m_glob):
    def fake_glob(pattern):
        msdos = ["/dev/msdosfs/EFISYS"]
        iso9660 = ["/dev/iso9660/config-2"]
        if pattern == "/dev/msdosfs/*":
            return msdos
        elif pattern == "/dev/iso9660/*":
            return iso9660
        raise Exception
    m_glob.side_effect = fake_glob

    devlist = util.find_devs_with_freebsd()
    assert set(devlist) == set([
        '/dev/iso9660/config-2', '/dev/msdosfs/EFISYS'])
    devlist = util.find_devs_with_freebsd(criteria="TYPE=iso9660")
    assert devlist == ['/dev/iso9660/config-2']
    devlist = util.find_devs_with_freebsd(criteria="TYPE=vfat")
    assert devlist == ['/dev/msdosfs/EFISYS']
Ejemplo n.º 2
0
    def test_find_devs_with_freebsd(self, m_glob, criteria, expected_devlist):
        def fake_glob(pattern):
            msdos = ["/dev/msdosfs/EFISYS"]
            iso9660 = ["/dev/iso9660/config-2"]
            if pattern == "/dev/msdosfs/*":
                return msdos
            elif pattern == "/dev/iso9660/*":
                return iso9660
            raise Exception

        m_glob.side_effect = fake_glob

        devlist = util.find_devs_with_freebsd(criteria=criteria)
        assert devlist == expected_devlist