def test_noroot(self, fn_getcachedir): cache = Cache() cache.prefix = '/var/lib/spinning' cache.suffix = 'i286/20' self.assertEqual(fn_getcachedir.call_count, 0) self.assertEqual(cache.cachedir, '/notmp/dnf-walr-yeAH/i286/20') self.assertEqual(fn_getcachedir.call_count, 1) # the cachedirs are cached now, getCacheDir is not called again: self.assertEqual(cache.cachedir, '/notmp/dnf-walr-yeAH/i286/20') self.assertEqual(fn_getcachedir.call_count, 1)
def test_root(self, unused_am_i_root): cache = Cache() cache.prefix = '/var/lib/spinning' cache.suffix = 'i286/20' self.assertEqual(cache.cachedir, '/var/lib/spinning/i286/20') self.assertEqual(cache.fallback_cachedir, None)