Repository: Duke-GCB/DukeDSClient

Issue:
Checks for terminal encoding prevents piping/redirection
Noticed when I was reviewing #153 that I can't pipe the output of ddsclient anywhere because it fails the terminal encoding check:

```
$ ddsclient list > projects

ERROR: DukeDSClient requires UTF terminal encoding.

Follow this guide for adjusting your terminal encoding:
  https://github.com/Duke-GCB/DukeDSClient/blob/master/docs/UnicodeTerminalSetup.md
```

I can force with `PYTHONIOENCODING=UTF ddsclient list > projects`

But that's not very unix-y. I've also seen this issue on cluster jobs - trying to srun ddsclient. Had to force the PYTHONIOENCODING there too.

Discussion:

Patch:
diff --git a/ddsc/core/util.py b/ddsc/core/util.py
index 8307bb0..1af9afc 100644
--- a/ddsc/core/util.py
+++ b/ddsc/core/util.py
@@ -301,8 +301,7 @@ def verify_terminal_encoding(encoding):
     Raises ValueError with error message when terminal encoding is not Unicode(contains UTF ignoring case).
     :param encoding: str: encoding we want to check
     """
-    encoding = encoding or ''
-    if not ("UTF" in encoding.upper()):
+    if encoding and not ("UTF" in encoding.upper()):
         raise ValueError(TERMINAL_ENCODING_NOT_UTF_ERROR)
 
 


Test patch:
diff --git a/ddsc/core/tests/test_util.py b/ddsc/core/tests/test_util.py
index dc20606..4d42be9 100644
--- a/ddsc/core/tests/test_util.py
+++ b/ddsc/core/tests/test_util.py
@@ -16,13 +16,11 @@ class TestUtil(TestCase):
         with self.assertRaises(ValueError):
             verify_terminal_encoding('ascii')
 
-    def test_verify_terminal_encoding_empty_raises(self):
-        with self.assertRaises(ValueError):
-            verify_terminal_encoding('')
+    def test_verify_terminal_encoding_empty_is_ok(self):
+        verify_terminal_encoding('')
 
-    def test_verify_terminal_encoding_none_raises(self):
-        with self.assertRaises(ValueError):
-            verify_terminal_encoding(None)
+    def test_verify_terminal_encoding_none_is_ok(self):
+        verify_terminal_encoding(None)
 
 
 class TestProgressBar(TestCase):