-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
e2xgrader/tests/server_extensions/apps/diagram_editor/test_diagrameditor.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import unittest | ||
|
||
from traitlets.config import LoggingConfigurable | ||
|
||
from e2xgrader.server_extensions.apps.diagram_editor import DiagramEditor | ||
|
||
|
||
class DummyWebApp: | ||
@property | ||
def settings(self): | ||
return dict() | ||
|
||
|
||
class DummyApp(LoggingConfigurable): | ||
root_dir = "dummy" | ||
name = "dummy" | ||
|
||
@property | ||
def web_app(self): | ||
return DummyWebApp() | ||
|
||
|
||
class TestDiagramEditor(unittest.TestCase): | ||
def setUp(self) -> None: | ||
self.editor = DiagramEditor(parent=DummyApp()) | ||
|
||
def test_empty_config(self): | ||
self.assertDictEqual(self.editor.get_diagram_config(), dict()) | ||
|
||
def test_configure_draw_domain(self): | ||
domain = "myDomain" | ||
self.editor.drawDomain = domain | ||
self.assertDictEqual(self.editor.get_diagram_config(), dict(drawDomain=domain)) | ||
|
||
def test_configure_draw_origin(self): | ||
domain = "myDomain" | ||
self.editor.drawOrigin = domain | ||
self.assertDictEqual(self.editor.get_diagram_config(), dict(drawOrigin=domain)) | ||
|
||
def test_configure_libraries(self): | ||
libraries = ["lib1", "lib2", "lib3"] | ||
self.editor.libraries = libraries | ||
self.assertDictEqual(self.editor.get_diagram_config(), dict(libs=libraries)) | ||
|
||
def tearDown(self) -> None: | ||
self.editor.drawDomain = None | ||
self.editor.drawOrigin = None | ||
self.editor.libraries = [] |