Procházet zdrojové kódy

HUE-2523 [core] Convert tests to the new generator

Romain Rigaux před 10 roky
rodič
revize
09f20df2e5

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 2 - 2
apps/search/src/search/tests.py


+ 2 - 1
desktop/core/src/desktop/lib/export_csvxls.py

@@ -127,7 +127,8 @@ def make_response(generator, format, name, encoding=None):
   if format == 'csv':
     content_type = 'application/csv'
   elif format == 'xls':
-    content_type = 'application/xlsx'
+    content_type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
+    format = 'xlsx'
   elif format == 'json':
     content_type = 'application/json'
   else:

+ 6 - 6
desktop/core/src/desktop/lib/test_export_csvxls.py

@@ -47,10 +47,10 @@ def test_export_xls():
   # Check XLS
   generator = create_generator(content_generator(headers, data), "xls")
   response = make_response(generator, "xls", "foo")
-  assert_equal("application/xls", response["content-type"])
+  assert_equal("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", response["content-type"])
   content = ''.join(response.streaming_content)
   assert_equal(dataset.xls, content)
-  assert_equal("attachment; filename=foo.xls", response["content-disposition"])
+  assert_equal("attachment; filename=foo.xlsx", response["content-disposition"])
 
 def test_export_xls_truncate_rows():
   headers = ["a"]
@@ -62,10 +62,10 @@ def test_export_xls_truncate_rows():
   # Check XLS
   generator = create_generator(content_generator(headers, data), "xls")
   response = make_response(generator, "xls", "foo")
-  assert_equal("application/xls", response["content-type"])
+  assert_equal("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", response["content-type"])
   content = ''.join(response.streaming_content)
   assert_equal(dataset.xls, content)
-  assert_equal("attachment; filename=foo.xls", response["content-disposition"])
+  assert_equal("attachment; filename=foo.xlsx", response["content-disposition"])
 
 def test_export_xls_truncate_cols():
   headers = ["a"] * (MAX_XLS_COLS + 1)
@@ -77,7 +77,7 @@ def test_export_xls_truncate_cols():
   # Check XLS
   generator = create_generator(content_generator(headers, data), "xls")
   response = make_response(generator, "xls", "foo")
-  assert_equal("application/xls", response["content-type"])
+  assert_equal("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", response["content-type"])
   content = ''.join(response.streaming_content)
   assert_equal(dataset.xls, content)
-  assert_equal("attachment; filename=foo.xls", response["content-disposition"])
+  assert_equal("attachment; filename=foo.xlsx", response["content-disposition"])

+ 1 - 0
ext/thirdparty/README.md

@@ -29,6 +29,7 @@ Checked-in third party dependencies
 |Y|Markdown|2.0.3|BSD|http://pypi.python.org/packages/source/M/Markdown/Markdown-2.0.3.tar.gz|
 |Y|MarkupSafe|0.9.3|BSD|http://pypi.python.org/pypi/MarkupSafe|
 |Y|MySQL for Python|1.2.3c1|GPL or the original license based on Python 1.5.2|http://sourceforge.net/projects/mysql-python/|
+|Y|openpyxl|2.3.0|MIT|https://pypi.python.org/packages/source/o/openpyxl/openpyxl-2.3.0-b2.tar.gz|
 |Y|ordereddict|1.1|MIT|https://pypi.python.org/pypi/ordereddict|
 |Y|parquet-python||ASL2|https://github.com/jcrobak/parquet-python|
 |Y|Pygments|1.3.1|BSD|http://pypi.python.org/pypi/Pygments|

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů