Przeglądaj źródła

HUE-8737 [oozie] Fix Oozie tests TestDashboard for py3

Ying Chen 5 lat temu
rodzic
commit
7060796f1e

+ 4 - 1
apps/oozie/src/oozie/importlib/workflows.py

@@ -498,7 +498,10 @@ def _prepare_nodes(workflow, root):
   - Deserialize
   - Automatically skip undefined nodes.
   """
-  objs = serializers.deserialize('xml', etree.tostring(root))
+  xml_str = etree.tostring(root)
+  if not isinstance(xml_str, str):
+    xml_str = xml_str.decode('utf-8')
+  objs = serializers.deserialize('xml', xml_str)
 
   # First pass is a list of nodes and their types respectively.
   # Must link up nodes with their respective full nodes.

+ 1 - 1
apps/oozie/src/oozie/models2_tests.py

@@ -486,7 +486,7 @@ LIMIT $limit"""))
 
       # other user can access document
       response = self.client_not_me.get(reverse('oozie:edit_workflow'), {'workflow': wf_doc.uuid})
-      assert_false('Document does not exist or you don't have the permission to access it.' in response.content, response.content)
+      assert_false(b'Document does not exist or you don't have the permission to access it.' in response.content, response.content)
     finally:
       wf_doc.delete()
 

+ 1 - 1
apps/oozie/src/oozie/templates/dashboard/list_oozie_bundle.mako

@@ -284,7 +284,7 @@ ${ layout.menubar(section='bundles', dashboard=True) }
       </div>
 
       <div class="tab-pane" id="definition">
-        <div id="definitionEditor">${ oozie_bundle.definition.decode('utf-8', 'replace') }</div>
+        <div id="definitionEditor">${ oozie_bundle.definition if isinstance(oozie_bundle.definition, str) else oozie_bundle.definition.decode('utf-8', 'replace') }</div>
       </div>
     </div>
 

+ 1 - 1
apps/oozie/src/oozie/templates/dashboard/list_oozie_coordinator.mako

@@ -418,7 +418,7 @@ ${ layout.menubar(section='coordinators', dashboard=True) }
             </div>
 
             <div class="tab-pane" id="definition" style="margin-bottom: 10px;">
-              <div id="definitionEditor">${ oozie_coordinator.definition.decode('utf-8', 'replace') }</div>
+              <div id="definitionEditor">${ oozie_coordinator.definition if isinstance(oozie_coordinator.definition, str) else oozie_coordinator.definition.decode('utf-8', 'replace') }</div>
             </div>
 
             % if oozie_coordinator.has_sla:

+ 7 - 2
apps/oozie/src/oozie/templates/dashboard/list_oozie_workflow.mako

@@ -16,9 +16,14 @@
 ## limitations under the License.
 
 <%!
+  import sys
   from desktop.views import commonheader, commonfooter
   from django.utils.translation import ugettext as _
   from oozie.forms import ParameterForm
+  from six import iteritems
+
+  if sys.version_info[0] > 2:
+    unicode = str
 %>
 
 <%namespace name="layout" file="../navigation-bar.mako" />
@@ -68,7 +73,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
 
           % if parameters and len(parameters) <= 15:
             <li class="nav-header">${ _('Variables') }</li>
-            % for var, value in parameters.iteritems():
+            % for var, value in iteritems(parameters):
                 % if utils.is_linkable(var, unicode(value)):
                   <li rel="tooltip" title="${ var } : ${ str(value) }">
                     <a href="${ utils.hdfs_link_js(str(value)) }"><i class="fa fa-eye"></i> <span class="variable hide">${ var }</span></a>
@@ -293,7 +298,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
         </div>
 
         <div class="tab-pane" id="definition">
-          <div id="definitionEditor">${ oozie_workflow.definition.decode('utf-8', 'replace') }</div>
+          <div id="definitionEditor">${ oozie_workflow.definition if isinstance(oozie_workflow.definition, str) else oozie_workflow.definition.decode('utf-8', 'replace') }</div>
         </div>
 
         % if oozie_workflow.has_sla:

+ 4 - 0
apps/oozie/src/oozie/templates/editor/gen/workflow-graph-status.xml.mako

@@ -20,7 +20,11 @@
 
 <%!
   import re
+  import sys
   from django.utils.translation import ugettext as _
+
+  if sys.version_info[0] > 2:
+    unicode = str
 %>
 
 <%def name="get_tab(form, action, control, css_box_class)">

+ 2 - 1
apps/oozie/src/oozie/templates/editor2/common_scheduler.inc.mako

@@ -15,6 +15,7 @@
 ## limitations under the License.
 
 <%!
+from builtins import range
 from desktop.views import _ko
 from django.utils.translation import ugettext as _
 %>
@@ -282,7 +283,7 @@ from django.utils.translation import ugettext as _
                           ${ _('Every') }
                         </span>
                         <select data-bind="value: frequency_number, visible: ! same_frequency(), enable: $root.isEditing" style="width: 50px">
-                          % for i in xrange(0, 60):
+                          % for i in range(0, 60):
                           <option value="${ i }">${ i }</option>
                           % endfor
                         </select>

+ 4 - 0
apps/oozie/src/oozie/templates/editor2/gen/workflow-graph-status.xml.mako

@@ -19,7 +19,11 @@
 <%namespace name="utils" file="../../utils.inc.mako" />
 
 <%!
+  import sys
   from django.utils.translation import ugettext as _
+
+  if sys.version_info[0] > 2:
+    unicode = str
 %>
 
 <%def name="get_tab(form, action, control, css_box_class)">

+ 4 - 0
apps/oozie/src/oozie/templates/utils.inc.mako

@@ -25,6 +25,7 @@
 <%!
   import logging
   import posixpath
+  import sys
   import time
 
   from django.template.defaultfilters import date, time as dtime
@@ -34,6 +35,9 @@
   from hadoop.fs.hadoopfs import Hdfs
   from liboozie.utils import format_time
 
+  if sys.version_info[0] > 2:
+    unicode = str
+
   LOG = logging.getLogger(__name__)
 %>
 

+ 169 - 140
apps/oozie/src/oozie/tests.py

@@ -821,7 +821,7 @@ class TestAPI(OozieMockBase):
   def test_autocomplete(self):
     response = self.c.get(reverse('oozie:autocomplete_properties'))
     test_response_json = response.content
-    assert_true('mapred.input.dir' in test_response_json)
+    assert_true(b'mapred.input.dir' in test_response_json)
 
 
 class TestApiPermissionsWithOozie(OozieBase):
@@ -1638,8 +1638,8 @@ class TestEditor(OozieMockBase):
     coord = create_coordinator(self.wf, client_another_me, self.user)
 
     response = client_another_me.get(reverse('oozie:edit_coordinator', args=[coord.id]))
-    assert_true('Editor' in response.content, response.content)
-    assert_true('Save coordinator' in response.content, response.content)
+    assert_true(b'Editor' in response.content, response.content)
+    assert_true(b'Save coordinator' in response.content, response.content)
 
     # Check can schedule a non personal/shared workflow
     workflow_select = '%s</option>' % self.wf
@@ -1907,8 +1907,8 @@ class TestEditor(OozieMockBase):
 
   def test_workflow_data_binds(self):
     response = self.c.get(reverse('oozie:edit_workflow', args=[self.wf.id]))
-    assert_equal(1, response.content.count('checked: is_shared'), response.content)
-    assert_true('checked: capture_output' in response.content, response.content)
+    assert_equal(1, response.content.count(b'checked: is_shared'), response.content)
+    assert_true(b'checked: capture_output' in response.content, response.content)
 
 
   def test_xss_escape_js(self):
@@ -2172,14 +2172,14 @@ class TestEditorBundle(OozieMockBase):
     }
 
     response = self.c.get(reverse('oozie:create_bundled_coordinator', args=[bundle.id]))
-    assert_true('Add coordinator' in response.content, response.content)
+    assert_true(b'Add coordinator' in response.content, response.content)
 
     response = self.c.post(reverse('oozie:create_bundled_coordinator', args=[bundle.id]), post, follow=True)
-    assert_true('This field is required' in response.content, response.content)
+    assert_true(b'This field is required' in response.content, response.content)
 
     post['create-bundled-coordinator-coordinator'] = ['%s' % coord.id]
     response = self.c.post(reverse('oozie:create_bundled_coordinator', args=[bundle.id]), post, follow=True)
-    assert_true('Coordinators' in response.content, response.content)
+    assert_true(b'Coordinators' in response.content, response.content)
 
     xml = bundle.to_xml({
        'wf_%s_dir' % self.wf.id: '/deployment_path_wf',
@@ -2644,8 +2644,8 @@ class TestPermissions(OozieBase):
     raise SkipTest
 
     response = self.c.get(reverse('oozie:edit_workflow', args=[self.wf.id]))
-    assert_true('Editor' in response.content, response.content)
-    assert_true('Save' in response.content, response.content)
+    assert_true(b'Editor' in response.content, response.content)
+    assert_true(b'Save' in response.content, response.content)
     assert_false(self.wf.is_shared)
 
     # Login as someone else
@@ -2656,13 +2656,13 @@ class TestPermissions(OozieBase):
     finish = SHARE_JOBS.set_for_testing(True)
     try:
       response = client_not_me.get(reverse('oozie:list_workflows'))
-      assert_false('wf-name-1' in response.content, response.content)
+      assert_false(b'wf-name-1' in response.content, response.content)
     finally:
       finish()
     finish = SHARE_JOBS.set_for_testing(False)
     try:
       response = client_not_me.get(reverse('oozie:list_workflows'))
-      assert_false('wf-name-1' in response.content, response.content)
+      assert_false(b'wf-name-1' in response.content, response.content)
     finally:
       finish()
 
@@ -2670,14 +2670,14 @@ class TestPermissions(OozieBase):
     finish = SHARE_JOBS.set_for_testing(True)
     try:
       response = client_not_me.get(reverse('oozie:edit_workflow', args=[self.wf.id]))
-      assert_true('Permission denied' in response.content, response.content)
+      assert_true(b'Permission denied' in response.content, response.content)
     finally:
       finish()
 
     finish = SHARE_JOBS.set_for_testing(False)
     try:
       response = client_not_me.get(reverse('oozie:edit_workflow', args=[self.wf.id]))
-      assert_true('Permission denied' in response.content, response.content)
+      assert_true(b'Permission denied' in response.content, response.content)
     finally:
       finish()
 
@@ -2692,7 +2692,7 @@ class TestPermissions(OozieBase):
     try:
       response = client_not_me.get(reverse('oozie:list_workflows'))
       assert_equal(200, response.status_code)
-      assert_true('wf-name-1' in response.content, response.content)
+      assert_true(b'wf-name-1' in response.content, response.content)
     finally:
       finish()
 
@@ -2700,14 +2700,14 @@ class TestPermissions(OozieBase):
     finish = SHARE_JOBS.set_for_testing(True)
     try:
       response = client_not_me.get(reverse('oozie:edit_workflow', args=[self.wf.id]))
-      assert_false('Permission denied' in response.content, response.content)
+      assert_false(b'Permission denied' in response.content, response.content)
     finally:
       finish()
 
     finish = SHARE_JOBS.set_for_testing(False)
     try:
       response = client_not_me.get(reverse('oozie:edit_workflow', args=[self.wf.id]))
-      assert_true('Permission denied' in response.content, response.content)
+      assert_true(b'Permission denied' in response.content, response.content)
     finally:
       finish()
 
@@ -2715,7 +2715,7 @@ class TestPermissions(OozieBase):
     finish = SHARE_JOBS.set_for_testing(False)
     try:
       response = client_not_me.post(reverse('oozie:submit_workflow', args=[self.wf.id]))
-      assert_true('Permission denied' in response.content, response.content)
+      assert_true(b'Permission denied' in response.content, response.content)
     finally:
       finish()
 
@@ -2723,7 +2723,7 @@ class TestPermissions(OozieBase):
     try:
       try:
         response = client_not_me.post(reverse('oozie:submit_workflow', args=[self.wf.id]))
-        assert_false('Permission denied' in response.content, response.content)
+        assert_false(b'Permission denied' in response.content, response.content)
       except IOError:
         pass
     finally:
@@ -2733,7 +2733,7 @@ class TestPermissions(OozieBase):
     finish = SHARE_JOBS.set_for_testing(False)
     try:
       response = client_not_me.post(reverse('oozie:delete_workflow'), {'job_selection': [self.wf.id]})
-      assert_true('Permission denied' in response.content, response.content)
+      assert_true(b'Permission denied' in response.content, response.content)
     finally:
       finish()
 
@@ -2755,7 +2755,7 @@ class TestPermissions(OozieBase):
     finish = SHARE_JOBS.set_for_testing(False)
     try:
       response = client_not_me.post(reverse('oozie:restore_workflow'), {'job_selection': [self.wf.id]})
-      assert_true('Permission denied' in response.content, response.content)
+      assert_true(b'Permission denied' in response.content, response.content)
     finally:
       finish()
 
@@ -2769,8 +2769,8 @@ class TestPermissions(OozieBase):
     coord = create_coordinator(self.wf, self.c, self.user)
 
     response = self.c.get(reverse('oozie:edit_coordinator', args=[coord.id]))
-    assert_true('Editor' in response.content, response.content)
-    assert_true('Save coordinator' in response.content, response.content)
+    assert_true(b'Editor' in response.content, response.content)
+    assert_true(b'Save coordinator' in response.content, response.content)
 
     # Login as someone else
     client_not_me = make_logged_in_client(username='not_me', is_superuser=False, groupname='test')
@@ -2780,14 +2780,14 @@ class TestPermissions(OozieBase):
     finish = SHARE_JOBS.set_for_testing(True)
     try:
       response = client_not_me.get(reverse('oozie:list_coordinators'))
-      assert_false('MyCoord' in response.content, response.content)
+      assert_false(b'MyCoord' in response.content, response.content)
     finally:
       finish()
 
     finish = SHARE_JOBS.set_for_testing(False)
     try:
       response = client_not_me.get(reverse('oozie:list_coordinators'))
-      assert_false('MyCoord' in response.content, response.content)
+      assert_false(b'MyCoord' in response.content, response.content)
     finally:
       finish()
 
@@ -2795,14 +2795,14 @@ class TestPermissions(OozieBase):
     finish = SHARE_JOBS.set_for_testing(True)
     try:
       response = client_not_me.get(reverse('oozie:edit_coordinator', args=[coord.id]))
-      assert_true('Permission denied' in response.content, response.content)
+      assert_true(b'Permission denied' in response.content, response.content)
     finally:
       finish()
 
     finish = SHARE_JOBS.set_for_testing(False)
     try:
       response = client_not_me.get(reverse('oozie:edit_coordinator', args=[coord.id]))
-      assert_false('MyCoord' in response.content, response.content)
+      assert_false(b'MyCoord' in response.content, response.content)
     finally:
       finish()
 
@@ -2831,7 +2831,7 @@ class TestPermissions(OozieBase):
     try:
       response = client_not_me.get(reverse('oozie:list_coordinators'))
       assert_equal(200, response.status_code)
-      assert_true('MyCoord' in response.content, response.content)
+      assert_true(b'MyCoord' in response.content, response.content)
     finally:
       finish()
 
@@ -2839,15 +2839,15 @@ class TestPermissions(OozieBase):
     finish = SHARE_JOBS.set_for_testing(True)
     try:
       response = client_not_me.get(reverse('oozie:edit_coordinator', args=[coord.id]))
-      assert_false('Permission denied' in response.content, response.content)
-      assert_false('Save coordinator' in response.content, response.content)
+      assert_false(b'Permission denied' in response.content, response.content)
+      assert_false(b'Save coordinator' in response.content, response.content)
     finally:
       finish()
 
     finish = SHARE_JOBS.set_for_testing(False)
     try:
       response = client_not_me.get(reverse('oozie:edit_coordinator', args=[coord.id]))
-      assert_true('Permission denied' in response.content, response.content)
+      assert_true(b'Permission denied' in response.content, response.content)
     finally:
       finish()
 
@@ -2855,8 +2855,8 @@ class TestPermissions(OozieBase):
     finish = SHARE_JOBS.set_for_testing(True)
     try:
       response = client_not_me.post(reverse('oozie:edit_coordinator', args=[coord.id]))
-      assert_false('MyCoord' in response.content, response.content)
-      assert_true('Not allowed' in response.content, response.content)
+      assert_false(b'MyCoord' in response.content, response.content)
+      assert_true(b'Not allowed' in response.content, response.content)
     finally:
       finish()
 
@@ -2864,7 +2864,7 @@ class TestPermissions(OozieBase):
     finish = SHARE_JOBS.set_for_testing(False)
     try:
       response = client_not_me.post(reverse('oozie:submit_coordinator', args=[coord.id]))
-      assert_true('Permission denied' in response.content, response.content)
+      assert_true(b'Permission denied' in response.content, response.content)
     finally:
       finish()
 
@@ -2872,7 +2872,7 @@ class TestPermissions(OozieBase):
     try:
       try:
         response = client_not_me.post(reverse('oozie:submit_coordinator', args=[coord.id]))
-        assert_false('Permission denied' in response.content, response.content)
+        assert_false(b'Permission denied' in response.content, response.content)
       except IOError:
         pass
     finally:
@@ -2882,7 +2882,7 @@ class TestPermissions(OozieBase):
     finish = SHARE_JOBS.set_for_testing(False)
     try:
       response = client_not_me.post(reverse('oozie:delete_coordinator'), {'job_selection': [coord.id]})
-      assert_true('Permission denied' in response.content, response.content)
+      assert_true(b'Permission denied' in response.content, response.content)
     finally:
       finish()
 
@@ -2905,7 +2905,7 @@ class TestPermissions(OozieBase):
     finish = SHARE_JOBS.set_for_testing(False)
     try:
       response = client_not_me.post(reverse('oozie:restore_coordinator'), {'job_selection': [coord.id]})
-      assert_true('Permission denied' in response.content, response.content)
+      assert_true(b'Permission denied' in response.content, response.content)
     finally:
       finish()
 
@@ -2918,9 +2918,9 @@ class TestPermissions(OozieBase):
     bundle = create_bundle(self.c, self.user)
 
     response = self.c.get(reverse('oozie:edit_bundle', args=[bundle.id]))
-    assert_true('Editor' in response.content, response.content)
-    assert_true('MyBundle' in response.content, response.content)
-    assert_true('Save' in response.content, response.content)
+    assert_true(b'Editor' in response.content, response.content)
+    assert_true(b'MyBundle' in response.content, response.content)
+    assert_true(b'Save' in response.content, response.content)
     assert_false(bundle.is_shared)
 
     # Login as someone else
@@ -2931,13 +2931,13 @@ class TestPermissions(OozieBase):
     finish = SHARE_JOBS.set_for_testing(True)
     try:
       response = client_not_me.get(reverse('oozie:list_bundles'))
-      assert_false('MyBundle' in response.content, response.content)
+      assert_false(b'MyBundle' in response.content, response.content)
     finally:
       finish()
     finish = SHARE_JOBS.set_for_testing(False)
     try:
       response = client_not_me.get(reverse('oozie:list_bundles'))
-      assert_false('MyBundle' in response.content, response.content)
+      assert_false(b'MyBundle' in response.content, response.content)
     finally:
       finish()
 
@@ -2945,14 +2945,14 @@ class TestPermissions(OozieBase):
     finish = SHARE_JOBS.set_for_testing(True)
     try:
       response = client_not_me.get(reverse('oozie:edit_bundle', args=[bundle.id]))
-      assert_true('Permission denied' in response.content, response.content)
+      assert_true(b'Permission denied' in response.content, response.content)
     finally:
       finish()
 
     finish = SHARE_JOBS.set_for_testing(False)
     try:
       response = client_not_me.get(reverse('oozie:edit_bundle', args=[bundle.id]))
-      assert_true('Permission denied' in response.content, response.content)
+      assert_true(b'Permission denied' in response.content, response.content)
     finally:
       finish()
 
@@ -2965,7 +2965,7 @@ class TestPermissions(OozieBase):
     try:
       response = client_not_me.get(reverse('oozie:list_bundles'))
       assert_equal(200, response.status_code)
-      assert_true('MyBundle' in response.content, response.content)
+      assert_true(b'MyBundle' in response.content, response.content)
     finally:
       finish()
 
@@ -2973,14 +2973,14 @@ class TestPermissions(OozieBase):
     finish = SHARE_JOBS.set_for_testing(True)
     try:
       response = client_not_me.get(reverse('oozie:edit_bundle', args=[bundle.id]))
-      assert_false('Permission denied' in response.content, response.content)
+      assert_false(b'Permission denied' in response.content, response.content)
     finally:
       finish()
 
     finish = SHARE_JOBS.set_for_testing(False)
     try:
       response = client_not_me.get(reverse('oozie:edit_bundle', args=[bundle.id]))
-      assert_true('Permission denied' in response.content, response.content)
+      assert_true(b'Permission denied' in response.content, response.content)
     finally:
       finish()
 
@@ -2990,7 +2990,7 @@ class TestPermissions(OozieBase):
       response = client_not_me.post(reverse('oozie:submit_bundle', args=[bundle.id]),{
                      u'form-MAX_NUM_FORMS': [u''], u'form-INITIAL_FORMS': [u'0'], u'form-TOTAL_FORMS': [u'0']
                  })
-      assert_true('Permission denied' in response.content, response.content)
+      assert_true(b'Permission denied' in response.content, response.content)
     finally:
       finish()
 
@@ -3000,7 +3000,7 @@ class TestPermissions(OozieBase):
         response = client_not_me.post(reverse('oozie:submit_bundle', args=[bundle.id]), {
                        u'form-MAX_NUM_FORMS': [u''], u'form-INITIAL_FORMS': [u'0'], u'form-TOTAL_FORMS': [u'0']
                    })
-        assert_false('Permission denied' in response.content, response.content)
+        assert_false(b'Permission denied' in response.content, response.content)
       except IOError:
         pass
     finally:
@@ -3010,7 +3010,7 @@ class TestPermissions(OozieBase):
     finish = SHARE_JOBS.set_for_testing(False)
     try:
       response = client_not_me.post(reverse('oozie:delete_bundle'), {'job_selection': [bundle.id]})
-      assert_true('Permission denied' in response.content, response.content)
+      assert_true(b'Permission denied' in response.content, response.content)
     finally:
       finish()
 
@@ -3033,7 +3033,7 @@ class TestPermissions(OozieBase):
     finish = SHARE_JOBS.set_for_testing(False)
     try:
       response = client_not_me.post(reverse('oozie:restore_bundle'), {'job_selection': [bundle.id]})
-      assert_true('Permission denied' in response.content, response.content)
+      assert_true(b'Permission denied' in response.content, response.content)
     finally:
       finish()
 
@@ -3212,15 +3212,15 @@ class TestOozieSubmissions(OozieBase):
       raise SkipTest('HUE-2898: Skipping test until it can be debugged')
 
     response = self.c.get(reverse('oozie:list_oozie_info'))
-    assert_true('version' in response.content, response.content)
-    assert_true('NORMAL' in response.content, response.content)
+    assert_true(b'version' in response.content, response.content)
+    assert_true(b'NORMAL' in response.content, response.content)
 
-    assert_true('variables' in response.content, response.content)
-    assert_true('timers' in response.content, response.content)
-    assert_true('counters' in response.content, response.content)
+    assert_true(b'variables' in response.content, response.content)
+    assert_true(b'timers' in response.content, response.content)
+    assert_true(b'counters' in response.content, response.content)
 
-    assert_true('ownMinTime' in response.content, response.content)
-    assert_true('oozie.base.url' in response.content, response.content)
+    assert_true(b'ownMinTime' in response.content, response.content)
+    assert_true(b'oozie.base.url' in response.content, response.content)
 
   def test_imported_workflow_submission(self):
     # Workflow owned by "temp_user"
@@ -3301,7 +3301,7 @@ my_prop_not_filtered=10
         u'form-2-value': [u'/path/output'],
     }, follow=True)
 
-    assert_true('oozie_workflow' in list(response.context[0]._data.keys()), response.content)
+    assert_true(b'oozie_workflow' in list(response.context[0]._data.keys()), response.content)
     wf_id = response.context[0]._data['oozie_workflow'].id
 
     # Check if response contains log data
@@ -3322,7 +3322,7 @@ my_prop_not_filtered=10
     finish = OOZIE_URL.set_for_testing('http://not_localhost:11000/bad')
     try:
       response = self.c.get(reverse('oozie:list_oozie_workflows'))
-      assert_true('The Oozie server is not running' in response.content, response.content)
+      assert_true(b'The Oozie server is not running' in response.content, response.content)
     finally:
       finish()
 
@@ -3349,27 +3349,39 @@ class TestDashboard(OozieMockBase):
   def test_manage_workflow_dashboard(self):
     # Display of buttons happens in js now
     response = self.c.get(reverse('oozie:list_oozie_workflow', args=[MockOozieApi.WORKFLOW_IDS[0]]), {}, follow=True)
-    assert_true(('%s/kill' % MockOozieApi.WORKFLOW_IDS[0]) in response.content, response.content)
-    assert_true(('rerun_oozie_job/%s' % MockOozieApi.WORKFLOW_IDS[0]) in response.content, response.content)
-    assert_true(('%s/suspend' % MockOozieApi.WORKFLOW_IDS[0]) in response.content, response.content)
-    assert_true(('%s/resume' % MockOozieApi.WORKFLOW_IDS[0]) in response.content, response.content)
+    wf_id = MockOozieApi.WORKFLOW_IDS[0]
+    if not isinstance(wf_id, bytes):
+      wf_id = wf_id.encode('utf-8')
+    assert_true((b'%s/kill' % wf_id) in response.content, response.content)
+    assert_true((b'rerun_oozie_job/%s' % wf_id) in response.content, response.content)
+    assert_true((b'%s/suspend' % wf_id) in response.content, response.content)
+    assert_true((b'%s/resume' % wf_id) in response.content, response.content)
 
     response = self.c.get(reverse('oozie:list_oozie_workflow', args=[MockOozieApi.WORKFLOW_IDS[1]]), {}, follow=True)
-    assert_true(('%s/kill' % MockOozieApi.WORKFLOW_IDS[1]) in response.content, response.content)
-    assert_true(('rerun_oozie_job/%s' % MockOozieApi.WORKFLOW_IDS[1]) in response.content, response.content)
+    wf_id = MockOozieApi.WORKFLOW_IDS[1]
+    if not isinstance(wf_id, bytes):
+      wf_id = wf_id.encode('utf-8')
+    assert_true((b'%s/kill' % wf_id) in response.content, response.content)
+    assert_true((b'rerun_oozie_job/%s' % wf_id) in response.content, response.content)
 
 
   def test_manage_coordinator_dashboard(self):
     # Display of buttons happens in js now
     response = self.c.get(reverse('oozie:list_oozie_coordinator', args=[MockOozieApi.COORDINATOR_IDS[0]]), {}, follow=True)
-    assert_true(('%s/kill' % MockOozieApi.COORDINATOR_IDS[0]) in response.content, response.content)
-    assert_true(('rerun_oozie_coord/%s' % MockOozieApi.COORDINATOR_IDS[0]) in response.content, response.content)
-    assert_true(('%s/suspend' % MockOozieApi.COORDINATOR_IDS[0]) in response.content, response.content)
-    assert_true(('%s/resume' % MockOozieApi.COORDINATOR_IDS[0]) in response.content, response.content)
+    coor_id = MockOozieApi.COORDINATOR_IDS[0]
+    if not isinstance(coor_id, bytes):
+      coor_id = coor_id.encode('utf-8')
+    assert_true((b'%s/kill' % coor_id) in response.content, response.content)
+    assert_true((b'rerun_oozie_coord/%s' % coor_id) in response.content, response.content)
+    assert_true((b'%s/suspend' % coor_id) in response.content, response.content)
+    assert_true((b'%s/resume' % coor_id) in response.content, response.content)
 
     # Test log filtering
     url = reverse('oozie:get_oozie_job_log', args=[MockOozieApi.COORDINATOR_IDS[0]])
-    assert_true(url in response.content, response.content)
+    url_bytes = url
+    if not isinstance(url_bytes, bytes):
+      url_bytes = url_bytes.encode('utf-8')
+    assert_true(url_bytes in response.content, response.content)
     response = self.c.get(url + "?format=json&limit=100&loglevel=INFO&text=MapReduce")
     data = json.loads(response.content)
     assert_true(len(data['log'].split('\n')) <= 100)
@@ -3380,15 +3392,18 @@ class TestDashboard(OozieMockBase):
   def test_manage_bundles_dashboard(self):
     # Display of buttons happens in js now
     response = self.c.get(reverse('oozie:list_oozie_bundle', args=[MockOozieApi.BUNDLE_IDS[0]]), {}, follow=True)
-    assert_true(('%s/kill' % MockOozieApi.BUNDLE_IDS[0]) in response.content, response.content)
-    assert_true(('rerun_oozie_bundle/%s' % MockOozieApi.BUNDLE_IDS[0]) in response.content, response.content)
-    assert_true(('%s/suspend' % MockOozieApi.BUNDLE_IDS[0]) in response.content, response.content)
-    assert_true(('%s/resume' % MockOozieApi.BUNDLE_IDS[0]) in response.content, response.content)
+    bndl_id = MockOozieApi.BUNDLE_IDS[0]
+    if not isinstance(bndl_id, bytes):
+      bndl_id = bndl_id.encode('utf-8')
+    assert_true((b'%s/kill' % bndl_id) in response.content, response.content)
+    assert_true((b'rerun_oozie_bundle/%s' % bndl_id) in response.content, response.content)
+    assert_true((b'%s/suspend' % bndl_id) in response.content, response.content)
+    assert_true((b'%s/resume' % bndl_id) in response.content, response.content)
 
 
   def test_rerun_coordinator(self):
     response = self.c.get(reverse('oozie:rerun_oozie_coord', args=[MockOozieApi.WORKFLOW_IDS[0], '/path']))
-    assert_true('Rerun' in response.content, response.content)
+    assert_true(b'Rerun' in response.content, response.content)
 
   def test_sync_coord_workflow(self):
     wf_doc = save_temp_workflow(MockOozieApi.JSON_WORKFLOW_LIST[5], self.user)
@@ -3411,19 +3426,19 @@ class TestDashboard(OozieMockBase):
     }
 
     response = self.c.post(reverse('oozie:rerun_oozie_coord', args=[MockOozieApi.COORDINATOR_IDS[0], '/path']), post_data)
-    assert_false('Permission denied' in response.content, response.content)
+    assert_false(b'Permission denied' in response.content, response.content)
 
     # Login as someone else
     client_not_me = make_logged_in_client(username='not_me', is_superuser=False, groupname='test')
     grant_access("not_me", "test", "oozie")
 
     response = client_not_me.post(reverse('oozie:rerun_oozie_coord', args=[MockOozieApi.COORDINATOR_IDS[0], '/path']), post_data)
-    assert_true('Permission denied' in response.content, response.content)
+    assert_true(b'Permission denied' in response.content, response.content)
 
 
   def test_rerun_bundle(self):
     response = self.c.get(reverse('oozie:rerun_oozie_coord', args=[MockOozieApi.WORKFLOW_IDS[0], '/path']))
-    assert_true('Rerun' in response.content, response.content)
+    assert_true(b'Rerun' in response.content, response.content)
 
 
   def test_rerun_bundle_permissions(self):
@@ -3448,118 +3463,132 @@ class TestDashboard(OozieMockBase):
     }
 
     response = self.c.post(reverse('oozie:rerun_oozie_bundle', args=[MockOozieApi.BUNDLE_IDS[0], '/path']), post_data)
-    assert_false('Permission denied' in response.content, response.content)
+    assert_false(b'Permission denied' in response.content, response.content)
 
     # Login as someone else
     client_not_me = make_logged_in_client(username='not_me', is_superuser=False, groupname='test')
     grant_access("not_me", "test", "oozie")
 
     response = client_not_me.post(reverse('oozie:rerun_oozie_bundle', args=[MockOozieApi.BUNDLE_IDS[0], '/path']), post_data)
-    assert_true('Permission denied' in response.content, response.content)
+    assert_true(b'Permission denied' in response.content, response.content)
 
 
   def test_list_workflows(self):
     response = self.c.get(reverse('oozie:list_oozie_workflows'))
-    assert_true('Running' in response.content, response.content)
-    assert_true('Completed' in response.content, response.content)
+    assert_true(b'Running' in response.content, response.content)
+    assert_true(b'Completed' in response.content, response.content)
 
     response = self.c.get(reverse('oozie:list_oozie_workflows') + "?format=json")
     assert_true(len(json.loads(response.content)['jobs']) == 0)
 
     response = self.c.get(reverse('oozie:list_oozie_workflows') + "?format=json&status=RUNNING&status=PREP&status=SUSPENDED")
     for wf_id in MockOozieApi.WORKFLOW_IDS:
+      if not isinstance(wf_id, bytes):
+        wf_id = wf_id.encode('utf-8')
       assert_true(wf_id in response.content, response.content)
 
     response = self.c.get(reverse('oozie:list_oozie_workflows') + "?format=json&status=KILLED&status=FAILED")
     for wf_id in MockOozieApi.WORKFLOW_IDS:
+      if not isinstance(wf_id, bytes):
+        wf_id = wf_id.encode('utf-8')
       assert_true(wf_id in response.content, response.content)
 
 
   def test_list_coordinators(self):
     response = self.c.get(reverse('oozie:list_oozie_coordinators'))
-    assert_true('Running' in response.content, response.content)
-    assert_true('Completed' in response.content, response.content)
+    assert_true(b'Running' in response.content, response.content)
+    assert_true(b'Completed' in response.content, response.content)
 
     response = self.c.get(reverse('oozie:list_oozie_coordinators') + "?format=json")
     assert_true(len(json.loads(response.content)['jobs']) == 0)
 
     response = self.c.get(reverse('oozie:list_oozie_coordinators') + "?format=json&status=RUNNING&status=PREP&status=SUSPENDED")
     for coord_id in MockOozieApi.COORDINATOR_IDS:
+      if not isinstance(coord_id, bytes):
+        coord_id = coord_id.encode('utf-8')
       assert_true(coord_id in response.content, response.content)
 
     response = self.c.get(reverse('oozie:list_oozie_coordinators') + "?format=json&status=KILLED&status=FAILED&status=DONEWITHERROR")
     for coord_id in MockOozieApi.COORDINATOR_IDS:
+      if not isinstance(coord_id, bytes):
+        coord_id = coord_id.encode('utf-8')
       assert_true(coord_id in response.content, response.content)
 
 
   def test_list_bundles(self):
     response = self.c.get(reverse('oozie:list_oozie_bundles'))
-    assert_true('Running' in response.content, response.content)
-    assert_true('Completed' in response.content, response.content)
+    assert_true(b'Running' in response.content, response.content)
+    assert_true(b'Completed' in response.content, response.content)
 
     response = self.c.get(reverse('oozie:list_oozie_bundles') + "?format=json&status=RUNNING")
     for coord_id in MockOozieApi.BUNDLE_IDS:
+      if not isinstance(coord_id, bytes):
+        coord_id = coord_id.encode('utf-8')
       assert_true(coord_id in response.content, response.content)
 
     response = self.c.get(reverse('oozie:list_oozie_bundles') + "?format=json&status=SUCCEEDED")
     for coord_id in MockOozieApi.BUNDLE_IDS:
+      if not isinstance(coord_id, bytes):
+        coord_id = coord_id.encode('utf-8')
       assert_true(coord_id in response.content, response.content)
 
     response = self.c.get(reverse('oozie:list_oozie_bundles') + "?format=json&status=KILLED")
     for coord_id in MockOozieApi.BUNDLE_IDS:
+      if not isinstance(coord_id, bytes):
+        coord_id = coord_id.encode('utf-8')
       assert_true(coord_id in response.content, response.content)
 
 
   def test_list_workflow(self):
     response = self.c.get(reverse('oozie:list_oozie_workflow', args=[MockOozieApi.WORKFLOW_IDS[0]]))
-    assert_true('Workflow WordCount1' in response.content, response.content)
-    assert_true('Workflow' in response.content, response.content)
+    assert_true(b'Workflow WordCount1' in response.content, response.content)
+    assert_true(b'Workflow' in response.content, response.content)
 
     response = self.c.get(reverse('oozie:list_oozie_workflow', args=[MockOozieApi.WORKFLOW_IDS[0]]) + '?coordinator_job_id=%s' % MockOozieApi.COORDINATOR_IDS[0])
-    assert_true('Workflow WordCount1' in response.content, response.content)
-    assert_true('Workflow' in response.content, response.content)
-    assert_true('DailyWordCount1' in response.content, response.content)
-    assert_true('Coordinator' in response.content, response.content)
+    assert_true(b'Workflow WordCount1' in response.content, response.content)
+    assert_true(b'Workflow' in response.content, response.content)
+    assert_true(b'DailyWordCount1' in response.content, response.content)
+    assert_true(b'Coordinator' in response.content, response.content)
 
     # Test for unicode character '�' rendering
     response = self.c.get(reverse('oozie:list_oozie_workflow', args=[MockOozieApi.WORKFLOW_IDS[6]]))
-    assert_false('UnicodeEncodeError' in response.content, response.content)
-    assert_true('TestUnicodeParam' in response.content, response.content)
+    assert_false(b'UnicodeEncodeError' in response.content, response.content)
+    assert_true(b'TestUnicodeParam' in response.content, response.content)
 
 
   def test_list_workflow_action(self):
     response = self.c.get(reverse('oozie:list_oozie_workflow_action', args=['XXX']))
-    assert_true('Action WordCount' in response.content, response.content)
-    assert_true('job_201302280955_0018' in response.content, response.content)
-    assert_true('job_201302280955_0019' in response.content, response.content)
-    assert_true('job_201302280955_0020' in response.content, response.content)
+    assert_true(b'Action WordCount' in response.content, response.content)
+    assert_true(b'job_201302280955_0018' in response.content, response.content)
+    assert_true(b'job_201302280955_0019' in response.content, response.content)
+    assert_true(b'job_201302280955_0020' in response.content, response.content)
 
     response = self.c.get(reverse('oozie:list_oozie_workflow_action', args=['XXX']) + '?coordinator_job_id=%s&bundle_job_id=%s' % (MockOozieApi.COORDINATOR_IDS[0], MockOozieApi.BUNDLE_IDS[0]))
-    assert_true('Bundle' in response.content, response.content)
-    assert_true('MyBundle1' in response.content, response.content)
-    assert_true('Coordinator' in response.content, response.content)
-    assert_true('DailyWordCount1' in response.content, response.content)
-    assert_true('Workflow' in response.content, response.content)
-    assert_true('WordCount1' in response.content, response.content)
+    assert_true(b'Bundle' in response.content, response.content)
+    assert_true(b'MyBundle1' in response.content, response.content)
+    assert_true(b'Coordinator' in response.content, response.content)
+    assert_true(b'DailyWordCount1' in response.content, response.content)
+    assert_true(b'Workflow' in response.content, response.content)
+    assert_true(b'WordCount1' in response.content, response.content)
 
 
   def test_list_coordinator(self):
     response = self.c.get(reverse('oozie:list_oozie_coordinator', args=[MockOozieApi.COORDINATOR_IDS[4]]))
     assert_true(u'Coordinator DåilyWordCount5' in response.content.decode('utf-8', 'replace'), response.content.decode('utf-8', 'replace'))
-    assert_true('Workflow' in response.content, response.content)
+    assert_true(b'Workflow' in response.content, response.content)
 
     # Test action list
     response = self.c.get(reverse('oozie:list_oozie_coordinator', args=[MockOozieApi.COORDINATOR_IDS[5]]) + "?format=json&offset=1")
-    assert_true('00000013-120706144403213-oozie-oozi-C@1' in response.content, response.content)
-    assert_true('00000013-120706144403213-oozie-oozi-C@2' in response.content, response.content)
-    assert_true('00000013-120706144403213-oozie-oozi-C@3' in response.content, response.content)
-    assert_true('00000013-120706144403213-oozie-oozi-C@4' in response.content, response.content)
+    assert_true(b'00000013-120706144403213-oozie-oozi-C@1' in response.content, response.content)
+    assert_true(b'00000013-120706144403213-oozie-oozi-C@2' in response.content, response.content)
+    assert_true(b'00000013-120706144403213-oozie-oozi-C@3' in response.content, response.content)
+    assert_true(b'00000013-120706144403213-oozie-oozi-C@4' in response.content, response.content)
 
 
   def test_list_bundle(self):
     response = self.c.get(reverse('oozie:list_oozie_bundle', args=[MockOozieApi.BUNDLE_IDS[0]]))
-    assert_true('Bundle MyBundle1' in response.content, response.content)
-    assert_true('Coordinators' in response.content, response.content)
+    assert_true(b'Bundle MyBundle1' in response.content, response.content)
+    assert_true(b'Coordinators' in response.content, response.content)
 
   def test_workflow_timezones(self):
     job = MockOozieApi.get_job(MockOozieApi(), '0000007-120725142744176-oozie-oozi-W')
@@ -3598,133 +3627,133 @@ class TestDashboard(OozieMockBase):
 
   def test_workflows_permissions(self):
     response = self.c.get(reverse('oozie:list_oozie_workflows') + '?format=json&status=SUCCEEDED')
-    assert_true('WordCount1' in response.content, response.content)
+    assert_true(b'WordCount1' in response.content, response.content)
 
     # Rerun
     response = self.c.get(reverse('oozie:rerun_oozie_job', kwargs={'job_id': MockOozieApi.WORKFLOW_IDS[0],
                                                                    'app_path': MockOozieApi.JSON_WORKFLOW_LIST[0]['appPath']}))
-    assert_false('Permission denied.' in response.content, response.content)
+    assert_false(b'Permission denied.' in response.content, response.content)
 
     # Login as someone else
     client_not_me = make_logged_in_client(username='not_me', is_superuser=False, groupname='test', recreate=True)
     grant_access("not_me", "not_me", "oozie")
 
     response = client_not_me.get(reverse('oozie:list_oozie_workflows') + '?format=json&status=SUCCEEDED')
-    assert_false('WordCount1' in response.content, response.content)
+    assert_false(b'WordCount1' in response.content, response.content)
 
     # Rerun
     response = client_not_me.get(reverse('oozie:rerun_oozie_job', kwargs={'job_id': MockOozieApi.WORKFLOW_IDS[0],
                                                                           'app_path': MockOozieApi.JSON_WORKFLOW_LIST[0]['appPath']}))
-    assert_true('Permission denied.' in response.content, response.content)
+    assert_true(b'Permission denied.' in response.content, response.content)
 
     # Add read only access
     add_permission("not_me", "dashboard_jobs_access", "dashboard_jobs_access", "oozie")
 
     response = client_not_me.get(reverse('oozie:list_oozie_workflows')+"?format=json&status=SUCCEEDED")
-    assert_true('WordCount1' in response.content, response.content)
+    assert_true(b'WordCount1' in response.content, response.content)
 
     # Rerun
     response = client_not_me.get(reverse('oozie:rerun_oozie_job', kwargs={'job_id': MockOozieApi.WORKFLOW_IDS[0],
                                                                           'app_path': MockOozieApi.JSON_WORKFLOW_LIST[0]['appPath']}))
-    assert_true('Permission denied.' in response.content, response.content)
+    assert_true(b'Permission denied.' in response.content, response.content)
 
   def test_workflow_permissions(self):
     response = self.c.get(reverse('oozie:list_oozie_workflow', args=[MockOozieApi.WORKFLOW_IDS[0]]))
-    assert_true('WordCount1' in response.content, response.content)
-    assert_false('Permission denied' in response.content, response.content)
+    assert_true(b'WordCount1' in response.content, response.content)
+    assert_false(b'Permission denied' in response.content, response.content)
 
     response = self.c.get(reverse('oozie:list_oozie_workflow_action', args=['XXX']))
-    assert_false('Permission denied' in response.content, response.content)
+    assert_false(b'Permission denied' in response.content, response.content)
 
     # Login as someone else
     client_not_me = make_logged_in_client(username='not_me', is_superuser=False, groupname='test', recreate=True)
     grant_access("not_me", "not_me", "oozie")
 
     response = client_not_me.get(reverse('oozie:list_oozie_workflow', args=[MockOozieApi.WORKFLOW_IDS[0]]))
-    assert_true('Permission denied' in response.content, response.content)
+    assert_true(b'Permission denied' in response.content, response.content)
 
     response = client_not_me.get(reverse('oozie:list_oozie_workflow_action', args=['XXX']))
-    assert_true('Permission denied' in response.content, response.content)
+    assert_true(b'Permission denied' in response.content, response.content)
 
     # Add read only access
     add_permission("not_me", "dashboard_jobs_access", "dashboard_jobs_access", "oozie")
 
     response = client_not_me.get(reverse('oozie:list_oozie_workflow', args=[MockOozieApi.WORKFLOW_IDS[0]]))
-    assert_false('Permission denied' in response.content, response.content)
+    assert_false(b'Permission denied' in response.content, response.content)
 
 
   def test_coordinators_permissions(self):
     response = self.c.get(reverse('oozie:list_oozie_coordinators')+"?format=json&status=SUCCEEDED")
-    assert_true('DailyWordCount1' in response.content, response.content)
+    assert_true(b'DailyWordCount1' in response.content, response.content)
 
     # Login as someone else
     client_not_me = make_logged_in_client(username='not_me', is_superuser=False, groupname='test', recreate=True)
     grant_access("not_me", "not_me", "oozie")
 
     response = client_not_me.get(reverse('oozie:list_oozie_coordinators')+"?format=json&status=SUCCEEDED")
-    assert_false('DailyWordCount1' in response.content, response.content)
+    assert_false(b'DailyWordCount1' in response.content, response.content)
 
     # Add read only access
     add_permission("not_me", "dashboard_jobs_access", "dashboard_jobs_access", "oozie")
 
     response = client_not_me.get(reverse('oozie:list_oozie_coordinators')+"?format=json&status=SUCCEEDED")
-    assert_true('DailyWordCount1' in response.content, response.content)
+    assert_true(b'DailyWordCount1' in response.content, response.content)
 
 
   def test_coordinator_permissions(self):
     response = self.c.get(reverse('oozie:list_oozie_coordinator', args=[MockOozieApi.COORDINATOR_IDS[0]]))
-    assert_true('DailyWordCount1' in response.content, response.content)
-    assert_false('Permission denied' in response.content, response.content)
+    assert_true(b'DailyWordCount1' in response.content, response.content)
+    assert_false(b'Permission denied' in response.content, response.content)
 
     # Login as someone else
     client_not_me = make_logged_in_client(username='not_me', is_superuser=False, groupname='test', recreate=True)
     grant_access("not_me", "not_me", "oozie")
 
     response = client_not_me.get(reverse('oozie:list_oozie_coordinator', args=[MockOozieApi.COORDINATOR_IDS[0]]))
-    assert_true('Permission denied' in response.content, response.content)
+    assert_true(b'Permission denied' in response.content, response.content)
 
     # Add read only access
     add_permission("not_me", "dashboard_jobs_access", "dashboard_jobs_access", "oozie")
 
     response = client_not_me.get(reverse('oozie:list_oozie_coordinator', args=[MockOozieApi.COORDINATOR_IDS[0]]))
-    assert_false('Permission denied' in response.content, response.content)
+    assert_false(b'Permission denied' in response.content, response.content)
 
 
   def test_bundles_permissions(self):
     response = self.c.get(reverse('oozie:list_oozie_bundles') + "?format=json&status=SUCCEEDED")
-    assert_true('MyBundle1' in response.content, response.content)
+    assert_true(b'MyBundle1' in response.content, response.content)
 
     # Login as someone else
     client_not_me = make_logged_in_client(username='not_me', is_superuser=False, groupname='test', recreate=True)
     grant_access("not_me", "not_me", "oozie")
 
     response = client_not_me.get(reverse('oozie:list_oozie_bundles')+"?format=json&status=SUCCEEDED")
-    assert_false('MyBundle1' in response.content, response.content)
+    assert_false(b'MyBundle1' in response.content, response.content)
 
     # Add read only access
     add_permission("not_me", "dashboard_jobs_access", "dashboard_jobs_access", "oozie")
 
     response = client_not_me.get(reverse('oozie:list_oozie_bundles')+"?format=json&status=SUCCEEDED")
-    assert_true('MyBundle1' in response.content, response.content)
+    assert_true(b'MyBundle1' in response.content, response.content)
 
 
   def test_bundle_permissions(self):
     response = self.c.get(reverse('oozie:list_oozie_bundle', args=[MockOozieApi.BUNDLE_IDS[0]]))
-    assert_true('MyBundle1' in response.content, response.content)
-    assert_false('Permission denied' in response.content, response.content)
+    assert_true(b'MyBundle1' in response.content, response.content)
+    assert_false(b'Permission denied' in response.content, response.content)
 
     # Login as someone else
     client_not_me = make_logged_in_client(username='not_me', is_superuser=False, groupname='test', recreate=True)
     grant_access("not_me", "not_me", "oozie")
 
     response = client_not_me.get(reverse('oozie:list_oozie_bundle', args=[MockOozieApi.BUNDLE_IDS[0]]))
-    assert_true('Permission denied' in response.content, response.content)
+    assert_true(b'Permission denied' in response.content, response.content)
 
     # Add read only access
     add_permission("not_me", "dashboard_jobs_access", "dashboard_jobs_access", "oozie")
 
     response = client_not_me.get(reverse('oozie:list_oozie_bundle', args=[MockOozieApi.BUNDLE_IDS[0]]))
-    assert_false('Permission denied' in response.content, response.content)
+    assert_false(b'Permission denied' in response.content, response.content)
 
 
   def test_good_workflow_status_graph(self):
@@ -3754,7 +3783,7 @@ class TestDashboard(OozieMockBase):
 
   def test_list_oozie_sla(self):
     response = self.c.get(reverse('oozie:list_oozie_sla'))
-    assert_true('Oozie Dashboard' in response.content, response.content)
+    assert_true(b'Oozie Dashboard' in response.content, response.content)
 
     response = self.c.get(reverse('oozie:list_oozie_sla') + "?format=json")
     for sla in MockOozieApi.WORKFLOWS_SLAS:
@@ -3762,7 +3791,7 @@ class TestDashboard(OozieMockBase):
 
     response = self.c.post(reverse('oozie:list_oozie_sla') + "?format=json", {'job_name': 'kochang'})
     for sla in MockOozieApi.WORKFLOWS_SLAS:
-      assert_true('MISS' in response.content, response.content)
+      assert_true(b'MISS' in response.content, response.content)
 
 
 class GeneralTestsWithOozie(OozieBase):

+ 2 - 0
apps/oozie/src/oozie/views/dashboard.py

@@ -769,6 +769,8 @@ def sync_coord_workflow(request, job_id):
              'header': _('Sync Workflow definition?'),
              'action': reverse('oozie:sync_coord_workflow', kwargs={'job_id': job_id})
            }, force_template=True).content
+  if not isinstance(popup, str):
+    popup = popup.decode('utf-8')
   return JsonResponse(popup, safe=False)
 
 @show_oozie_error

+ 17 - 5
desktop/libs/liboozie/src/liboozie/types.py

@@ -47,7 +47,7 @@ from django.urls import reverse
 from desktop.auth.backend import is_admin
 
 if sys.version_info[0] > 2:
-  from io import StringIO as string_io
+  from io import BytesIO as string_io
 else:
   from cStringIO import StringIO as string_io
 
@@ -168,7 +168,10 @@ class WorkflowAction(Action):
       self.retries = int(self.retries)
 
     if self.conf:
-      xml = string_io(i18n.smart_str(self.conf))
+      conf_data = i18n.smart_str(self.conf)
+      if not isinstance(conf_data, bytes):
+        conf_data = conf_data.encode('utf-8')
+      xml = string_io(conf_data)
       try:
         self.conf_dict = hadoop.confparse.ConfParse(xml)
       except Exception as e:
@@ -244,7 +247,10 @@ class CoordinatorAction(Action):
       self.lastModifiedTime = parse_timestamp(self.lastModifiedTime)
 
     if self.runConf:
-      xml = string_io(i18n.smart_str(self.runConf))
+      conf_data = i18n.smart_str(self.runConf)
+      if not isinstance(conf_data, bytes):
+        conf_data = conf_data.encode('utf-8')
+      xml = string_io(conf_data)
       self.conf_dict = hadoop.confparse.ConfParse(xml)
     else:
       self.conf_dict = {}
@@ -292,7 +298,10 @@ class BundleAction(Action):
     self.name = self.coordJobName
 
     if self.conf:
-      xml = string_io(i18n.smart_str(self.conf))
+      conf_data = i18n.smart_str(self.conf)
+      if not isinstance(conf_data, bytes):
+        conf_data = conf_data.encode('utf-8')
+      xml = string_io(conf_data)
       self.conf_dict = hadoop.confparse.ConfParse(xml)
     else:
       self.conf_dict = {}
@@ -346,7 +355,10 @@ class Job(object):
 
     self.actions = [Action.create(self.ACTION, act_dict) for act_dict in self.actions]
     if self.conf is not None:
-      xml = string_io(i18n.smart_str(self.conf))
+      conf_data = i18n.smart_str(self.conf)
+      if not isinstance(conf_data, bytes):
+        conf_data = conf_data.encode('utf-8')
+      xml = string_io(conf_data)
       self.conf_dict = hadoop.confparse.ConfParse(xml)
     else:
       self.conf_dict = {}