Exemplo n.º 1
0
 def test_file(self, custom_mock_cfg):
     file_path = '/a_generated_file.txt'
     file_content = 'just some generated text'
     cmc = MockChroot(config=mock_chroot.config.compose(
         custom_mock_cfg, mock_chroot.config.file(file_path, file_content)))
     # Must clean the chroot for files to be created
     cmc.clean()
     output = cmc.chroot('cat', file_path)
     # If we got here, we've no exception so the file is there
     assert output == file_content
 def test_file(self, custom_mock_cfg):
     file_path = '/a_generated_file.txt'
     file_content = 'just some generated text'
     cmc = MockChroot(config=mock_chroot.config.compose(
         custom_mock_cfg,
         mock_chroot.config.file(file_path, file_content)
     ))
     # Must clean the chroot for files to be created
     cmc.clean()
     output = cmc.chroot('cat', file_path)
     # If we got here, we've no exception so the file is there
     assert output == file_content
 def test_clean(self):
     mc = MockChroot(root='epel-6-x86_64')
     expected = 'testing\n'
     output = mc.chroot('bash', '-c', 'echo testing | tee test.txt')
     assert output == expected
     output = mc.chroot('cat', 'test.txt')
     assert output == expected
     mc.clean()
     with pytest.raises(CalledProcessError):
         output = mc.chroot('cat', 'test.txt')
     expected = 'not there\n'
     output = mc.chroot('bash', '-c', 'test -e test.txt || echo not there')
     assert output == expected
 def test_clean(self):
     mc = MockChroot(root='epel-6-x86_64')
     expected = 'testing\n'
     output = mc.chroot('bash', '-c', 'echo testing | tee test.txt')
     assert output == expected
     output = mc.chroot('cat', 'test.txt')
     assert output == expected
     mc.clean()
     with pytest.raises(CalledProcessError):
         output = mc.chroot('cat', 'test.txt')
     expected = 'not there\n'
     output = mc.chroot('bash', '-c', 'test -e test.txt || echo not there')
     assert output == expected