Esempio n. 1
0
 def test_readlink_nonexisting(self):
     """
     Test 'readlink' is agnostinc to the path existance and simply adds the
     provided string (without a slash) to the current working directory.
     """
     self.mock_run_bash_cmd.return_value = os.path.join(os.getcwd(), "foo")
     self.assertEqual(readlink("foo"), self.mock_run_bash_cmd.return_value)
Esempio n. 2
0
 def test_readlink_tilde(self, mock_expanduser):
     """
     Test 'readlink' hadles '~' path.
     """
     mock_expanduser.return_value = "/home/<user name>"
     self.mock_run_bash_cmd.return_value = mock_expanduser.return_value
     self.assertEqual(readlink("~"), mock_expanduser.return_value)
Esempio n. 3
0
 def test_readlink_device_path(self):
     """
     Test 'readlink' returns the given path if it's unable to follow it.
     """
     self.mock_run_bash_cmd.return_value = "Phone/Card"
     self.assertEqual(readlink("Phone/Card"), "Phone/Card")
Esempio n. 4
0
 def test_readlink_slash(self):
     """
     Test 'readlink' hadles '/' path (and doesn't strip it).
     """
     self.mock_run_bash_cmd.return_value = "/"
     self.assertEqual(readlink("/"), "/")
Esempio n. 5
0
 def test_readlink_no_path(self):
     """
     Test 'readlink' returns an empty string in case of no path to read.
     """
     self.assertEqual(readlink(""), "")