Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ardublockly
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ardublockly
Commits
0f78e5d9
Commit
0f78e5d9
authored
Jun 19, 2015
by
carlosperate
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update unit test for compiler settings.
parent
1ac73a7d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
ardublocklyserver/tests/compilersettings_test.py
ardublocklyserver/tests/compilersettings_test.py
+7
-7
No files found.
ardublocklyserver/tests/compilersettings_test.py
View file @
0f78e5d9
...
@@ -49,8 +49,8 @@ class ServerCompilerSettingsTestCase(unittest.TestCase):
...
@@ -49,8 +49,8 @@ class ServerCompilerSettingsTestCase(unittest.TestCase):
self
.
assertEqual
(
ServerCompilerSettings
().
compiler_dir
,
self
.
assertEqual
(
ServerCompilerSettings
().
compiler_dir
,
ServerCompilerSettings
().
__compiler_dir__
)
ServerCompilerSettings
().
__compiler_dir__
)
@
mock
.
patch
(
'ardublocklyserver.compilersettings.os.path.
exists
'
)
@
mock
.
patch
(
'ardublocklyserver.compilersettings.os.path.
isfile
'
)
def
test_write_compiler_dir_invalid
(
self
,
mock_os_path_
exists
):
def
test_write_compiler_dir_invalid
(
self
,
mock_os_path_
isfile
):
"""
"""
Tests path doesn't get save if:
Tests path doesn't get save if:
A file that does not exists
A file that does not exists
...
@@ -59,7 +59,7 @@ class ServerCompilerSettingsTestCase(unittest.TestCase):
...
@@ -59,7 +59,7 @@ class ServerCompilerSettingsTestCase(unittest.TestCase):
"""
"""
# TODO: a file that 'exists but does not execute' is not done
# TODO: a file that 'exists but does not execute' is not done
# Random file
# Random file
mock_os_path_
exists
.
return_value
=
False
mock_os_path_
isfile
.
return_value
=
False
original_dir
=
ServerCompilerSettings
().
compiler_dir
original_dir
=
ServerCompilerSettings
().
compiler_dir
new_dir
=
os
.
path
.
join
(
os
.
getcwd
(),
'random.exe'
)
new_dir
=
os
.
path
.
join
(
os
.
getcwd
(),
'random.exe'
)
ServerCompilerSettings
().
compiler_dir
=
new_dir
ServerCompilerSettings
().
compiler_dir
=
new_dir
...
@@ -67,15 +67,15 @@ class ServerCompilerSettingsTestCase(unittest.TestCase):
...
@@ -67,15 +67,15 @@ class ServerCompilerSettingsTestCase(unittest.TestCase):
self
.
assertEqual
(
original_dir
,
ServerCompilerSettings
().
compiler_dir
)
self
.
assertEqual
(
original_dir
,
ServerCompilerSettings
().
compiler_dir
)
# No extension is accepted as a valid compiler directory
# No extension is accepted as a valid compiler directory
mock_os_path_
exists
.
return_value
=
True
mock_os_path_
isfile
.
return_value
=
True
new_dir
=
os
.
getcwd
()
new_dir
=
os
.
getcwd
()
ServerCompilerSettings
().
compiler_dir
=
new_dir
ServerCompilerSettings
().
compiler_dir
=
new_dir
self
.
assertTrue
(
new_dir
in
ServerCompilerSettings
().
compiler_dir
)
self
.
assertTrue
(
new_dir
in
ServerCompilerSettings
().
compiler_dir
)
self
.
assertNotEqual
(
original_dir
,
ServerCompilerSettings
().
compiler_dir
)
self
.
assertNotEqual
(
original_dir
,
ServerCompilerSettings
().
compiler_dir
)
@
mock
.
patch
(
'ardublocklyserver.compilersettings.os.path.
exists
'
)
@
mock
.
patch
(
'ardublocklyserver.compilersettings.os.path.
isfile
'
)
def
test_write_compiler_dir_valid
(
self
,
mock_os_path_
exists
):
def
test_write_compiler_dir_valid
(
self
,
mock_os_path_
isfile
):
mock_os_path_
exists
.
return_value
=
True
mock_os_path_
isfile
.
return_value
=
True
new_dir
=
os
.
path
.
join
(
os
.
getcwd
(),
'arduino.exe'
)
new_dir
=
os
.
path
.
join
(
os
.
getcwd
(),
'arduino.exe'
)
ServerCompilerSettings
().
compiler_dir
=
new_dir
ServerCompilerSettings
().
compiler_dir
=
new_dir
self
.
assertTrue
(
new_dir
in
ServerCompilerSettings
().
compiler_dir
)
self
.
assertTrue
(
new_dir
in
ServerCompilerSettings
().
compiler_dir
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment