mirror of https://github.com/databricks/cli.git
Fix workspace import test (#844)
Windows and unix have different new line characters. Separating the string assertions here to make the test pass.
This commit is contained in:
parent
847b6f4bc3
commit
054df2b58b
|
@ -369,7 +369,8 @@ func TestAccImportFileFormatAuto(t *testing.T) {
|
||||||
|
|
||||||
// Upload as file if path has no extension
|
// Upload as file if path has no extension
|
||||||
RequireSuccessfulRun(t, "workspace", "import", path.Join(targetDir, "py-nb-as-file"), "--file", "./testdata/import_dir/pyNotebook.py", "--format=AUTO")
|
RequireSuccessfulRun(t, "workspace", "import", path.Join(targetDir, "py-nb-as-file"), "--file", "./testdata/import_dir/pyNotebook.py", "--format=AUTO")
|
||||||
assertFilerFileContents(t, ctx, workspaceFiler, "py-nb-as-file", "# Databricks notebook source\nprint(\"python\")")
|
assertFilerFileContents(t, ctx, workspaceFiler, "py-nb-as-file", "# Databricks notebook source")
|
||||||
|
assertFilerFileContents(t, ctx, workspaceFiler, "py-nb-as-file", "print(\"python\")")
|
||||||
assertWorkspaceFileType(t, ctx, workspaceFiler, "py-nb-as-file", workspace.ObjectTypeFile)
|
assertWorkspaceFileType(t, ctx, workspaceFiler, "py-nb-as-file", workspace.ObjectTypeFile)
|
||||||
|
|
||||||
// Upload as notebook if path has extension
|
// Upload as notebook if path has extension
|
||||||
|
@ -379,6 +380,6 @@ func TestAccImportFileFormatAuto(t *testing.T) {
|
||||||
|
|
||||||
// Upload as file if content is not notebook (even if path has .py extension)
|
// Upload as file if content is not notebook (even if path has .py extension)
|
||||||
RequireSuccessfulRun(t, "workspace", "import", path.Join(targetDir, "not-a-notebook.py"), "--file", "./testdata/import_dir/file-a", "--format=AUTO")
|
RequireSuccessfulRun(t, "workspace", "import", path.Join(targetDir, "not-a-notebook.py"), "--file", "./testdata/import_dir/file-a", "--format=AUTO")
|
||||||
assertFilerFileContents(t, ctx, workspaceFiler, "not-a-notebook.py", "hello, world\n")
|
assertFilerFileContents(t, ctx, workspaceFiler, "not-a-notebook.py", "hello, world")
|
||||||
assertWorkspaceFileType(t, ctx, workspaceFiler, "not-a-notebook.py", workspace.ObjectTypeFile)
|
assertWorkspaceFileType(t, ctx, workspaceFiler, "not-a-notebook.py", workspace.ObjectTypeFile)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue