示例#1
0
 def testLoggablesNotEqual(self):
     cmd1 = sysinfo.Command("ls -l")
     cmd2 = sysinfo.Command("ls -la")
     self.assertNotEqual(cmd1, cmd2)
     file1 = sysinfo.Logfile("/proc/cpuinfo")
     file2 = sysinfo.Logfile("/etc/fstab")
     self.assertNotEqual(file1, file2)
示例#2
0
    def testLoggablesSet(self):
        container = set()
        cmd1 = sysinfo.Command("ls -l")
        cmd2 = sysinfo.Command("ls -l")
        cmd3 = sysinfo.Command("ps -ef")
        cmd4 = sysinfo.Command("uname -a")
        file1 = sysinfo.Command("/proc/cpuinfo")
        file2 = sysinfo.Command("/etc/fstab")
        file3 = sysinfo.Command("/etc/fstab")
        file4 = sysinfo.Command("/etc/fstab")
        # From the above 8 objects, only 5 are unique loggables.
        container.add(cmd1)
        container.add(cmd2)
        container.add(cmd3)
        container.add(cmd4)
        container.add(file1)
        container.add(file2)
        container.add(file3)
        container.add(file4)

        self.assertEqual(len(container), 5)