Skip to content

Commit

Permalink
Merge pull request #25 from sebastian-muthwill/dev-tests
Browse files Browse the repository at this point in the history
test: add test case for parser
  • Loading branch information
sebastian-muthwill authored Oct 18, 2021
2 parents 84d447d + 321bd9b commit 18a1d73
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
Empty file.
40 changes: 40 additions & 0 deletions powerapps_docstring/tests/test_parser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import pytest


SOURCE_PATH = "example/src/meetingcapturedemo/"


def test_instantiate_parser():
from powerapps_docstring.parser import Parser
p = Parser(SOURCE_PATH)

assert isinstance(p, Parser), ("Should be an instance of parser object")
assert p.source_path == SOURCE_PATH


def test_get_connections():
from powerapps_docstring.parser import Parser
p = Parser(SOURCE_PATH)
connections = p.get_connections()

# spot check on some values in connection
for con in connections.items():

assert "connectionInstanceId" in con[1].keys()
assert "connectionParameters" in con[1].keys()
assert "connectionRef" in con[1].keys()


def test_get_screen_objects():
from powerapps_docstring.parser import Parser
p = Parser(SOURCE_PATH)
result = p.get_screen_objects("WelcomeScreen.fx.yaml")
assert result[0] == "WelcomeScreen", "Should return on index 0 the name of the screen"
assert isinstance(result[1], dict), "Shall return on index 1 the screen contents as dict"


def test_get_canvas_manifest():
from powerapps_docstring.parser import Parser
p = Parser(SOURCE_PATH)
result = p.get_canvas_manifest()
assert isinstance(result, dict), "Shall return a dict with CanvasManifest content"

0 comments on commit 18a1d73

Please sign in to comment.