Browse Source

Applying pylint fixes to the file and change the setting_dict['OPTIONS'] to dict type from str

ayush.goyal 4 years ago
parent
commit
994fd8ff75
1 changed files with 51 additions and 27 deletions
  1. 51 27
      desktop/core/src/desktop/tests.py

+ 51 - 27
desktop/core/src/desktop/tests.py

@@ -131,29 +131,47 @@ def test_skip_wizard():
   c = make_logged_in_client() # is_superuser
 
   response = c.get('/', follow=True)
-  assert_true(['admin_wizard.mako' in _template.filename for _template in response.templates], [_template.filename for _template in response.templates])
+  assert_true(
+    ['admin_wizard.mako' in _template.filename for _template in response.templates],
+    [_template.filename for _template in response.templates]
+  )
 
   c.cookies['hueLandingPage'] = 'home'
   response = c.get('/', follow=True)
-  assert_true(['home.mako' in _template.filename for _template in response.templates], [_template.filename for _template in response.templates])
+  assert_true(
+    ['home.mako' in _template.filename for _template in response.templates],
+    [_template.filename for _template in response.templates]
+  )
 
   c.cookies['hueLandingPage'] = ''
   response = c.get('/', follow=True)
-  assert_true(['admin_wizard.mako' in _template.filename for _template in response.templates], [_template.filename for _template in response.templates])
+  assert_true(
+    ['admin_wizard.mako' in _template.filename for _template in response.templates],
+    [_template.filename for _template in response.templates]
+  )
 
 
   c = make_logged_in_client(username="test_skip_wizard", password="test_skip_wizard", is_superuser=False)
 
   response = c.get('/', follow=True)
-  assert_true(['home.mako' in _template.filename for _template in response.templates], [_template.filename for _template in response.templates])
+  assert_true(
+    ['home.mako' in _template.filename for _template in response.templates],
+    [_template.filename for _template in response.templates]
+  )
 
   c.cookies['hueLandingPage'] = 'home'
   response = c.get('/', follow=True)
-  assert_true(['home.mako' in _template.filename for _template in response.templates], [_template.filename for _template in response.templates])
+  assert_true(
+    ['home.mako' in _template.filename for _template in response.templates],
+    [_template.filename for _template in response.templates]
+  )
 
   c.cookies['hueLandingPage'] = ''
   response = c.get('/', follow=True)
-  assert_true(['home.mako' in _template.filename for _template in response.templates], [_template.filename for _template in response.templates])
+  assert_true(
+    ['home.mako' in _template.filename for _template in response.templates],
+    [_template.filename for _template in response.templates]
+  )
 
 def test_public_views():
   c = Client()
@@ -240,14 +258,20 @@ def hue_version():
   HUE_VERSION_BAK = HUE_VERSION
 
   try:
-    assert_equal('cdh6.x-SNAPSHOT', _version_from_properties(string_io("""# Autogenerated build properties
-version=3.9.0-cdh5.9.0-SNAPSHOT
-git.hash=f5fbe90b6a1d0c186b0ddc6e65ce5fc8d24725c8
-cloudera.cdh.release=cdh6.x-SNAPSHOT
-cloudera.hash=f5fbe90b6a1d0c186b0ddc6e65ce5fc8d24725c8aaaaa""")))
+    assert_equal('cdh6.x-SNAPSHOT', _version_from_properties(string_io(
+      """# Autogenerated build properties
+      version=3.9.0-cdh5.9.0-SNAPSHOT
+      git.hash=f5fbe90b6a1d0c186b0ddc6e65ce5fc8d24725c8
+      cloudera.cdh.release=cdh6.x-SNAPSHOT
+      cloudera.hash=f5fbe90b6a1d0c186b0ddc6e65ce5fc8d24725c8aaaaa"""))
+    )
 
-    assert_false(_version_from_properties(string_io("""# Autogenerated build properties
-version=3.9.0-cdh5.9.0-SNAPSHOT git.hash=f5fbe90b6a1d0c186b0ddc6e65ce5fc8d24725c8 cloudera.hash=f5fbe90b6a1d0c186b0ddc6e65ce5fc8d24725c8aaaaa""")))
+    assert_false(_version_from_properties(string_io(
+      """# Autogenerated build properties
+      version=3.9.0-cdh5.9.0-SNAPSHOT
+      git.hash=f5fbe90b6a1d0c186b0ddc6e65ce5fc8d24725c8
+      cloudera.hash=f5fbe90b6a1d0c186b0ddc6e65ce5fc8d24725c8aaaaa"""))
+    )
 
     assert_false(_version_from_properties(string_io('')))
   finally:
@@ -885,10 +909,10 @@ class TestStrictRedirection(object):
     response = self.client.post('/hue/accounts/login/', data, **kwargs )
     assert_equal(expected_status_code, response.status_code)
     if expected_status_code == 403:
-        error_msg = 'Redirect to ' + redirection_url + ' is not allowed.'
-        if not isinstance(error_msg, bytes):
-          error_msg = error_msg.encode('utf-8')
-        assert_true(error_msg in response.content, response.content)
+      error_msg = 'Redirect to ' + redirection_url + ' is not allowed.'
+      if not isinstance(error_msg, bytes):
+        error_msg = error_msg.encode('utf-8')
+      assert_true(error_msg in response.content, response.content)
 
 
 class BaseTestPasswordConfig(object):
@@ -1467,16 +1491,16 @@ def test_db_migrations_sqlite():
     file_name = 'hue_' + version + '.db'
     path = get_desktop_root('./core/src/desktop/test_data/' + file_name)
     DATABASES[name] = {
-      'ENGINE' : 'django.db.backends.sqlite3',
-      'NAME' : path,
-      'USER' : '',
-      'SCHEMA' : 'public',
-      'PASSWORD' : '',
-      'HOST' : '',
-      'PORT' : '',
-      'OPTIONS' : '',
-      'ATOMIC_REQUESTS' : True,
-      'CONN_MAX_AGE' : 0,
+      'ENGINE': 'django.db.backends.sqlite3',
+      'NAME': path,
+      'USER': '',
+      'SCHEMA': 'public',
+      'PASSWORD': '',
+      'HOST': '',
+      'PORT': '',
+      'OPTIONS': {},
+      'ATOMIC_REQUESTS': True,
+      'CONN_MAX_AGE': 0,
     }
     try:
       call_command('migrate', '--fake-initial', '--database=' + name)