Exemple #1
0
 def test_list_disks_calls_lsblk(self):
     mock_check_output = self.patch(subprocess, "check_output")
     mock_check_output.return_value = b""
     list_disks()
     self.assertThat(
         mock_check_output,
         MockCalledOnceWith(['lsblk', '-d', '-n', '-oKNAME,TYPE,RO']))
Exemple #2
0
 def test_list_disks_calls_lsblk(self):
     mock_check_output = self.patch(subprocess, "check_output")
     mock_check_output.return_value = b""
     list_disks()
     self.assertThat(
         mock_check_output,
         MockCalledOnceWith(["lsblk", "-d", "-n", "-oKNAME,TYPE,RO"]),
     )
Exemple #3
0
 def test_list_disks_returns_only_readwrite_disks(self):
     mock_check_output = self.patch(subprocess, "check_output")
     mock_check_output.return_value = dedent("""\
         sda   disk  0
         sdb   disk  1
         sr0   rom   0
         sr1   rom   0
         """).encode("ascii")
     self.assertEqual([b"sda"], list_disks())