def test_darwin_unfrozen(self):
     """Test that we get a source-relative path on unfrozen darwin."""
     self.patch(sys, "platform", "darwin")
     self.patch(utils, "__file__",
                os.path.join("path", "to", "ubuntuone",
                             "utils", "__init__.py"))
     path = utils.get_cert_dir()
     self.assertEqual(path, os.path.join("path", "to", "data"))
 def test_win(self):
     """Test geting a path when Common AppData is defined."""
     self.patch(utils, "__file__",
                os.path.join("path", "to", "ubuntuone",
                             "utils", "__init__.py"))
     self.patch(sys, "platform", "win32")
     path = utils.get_cert_dir()
     self.assertEqual(path, os.path.join("path", "to", "data"))
 def test_darwin_frozen(self):
     """Test that we get a path with .app in it on frozen darwin."""
     self.patch(sys, "platform", "darwin")
     sys.frozen = "macosx-app"
     self.addCleanup(delattr, sys, "frozen")
     self.patch(utils, "__file__",
                os.path.join("path", "to", "Main.app", "ignore"))
     path = utils.get_cert_dir()
     self.assertEqual(path, os.path.join("path", "to", "Main.app",
                                         "Contents", "Resources"))
 def test_linux(self):
     """Test that linux gets the right path."""
     self.patch(sys, "platform", "linux2")
     path = utils.get_cert_dir()
     self.assertEqual(path, "/etc/ssl/certs")