Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for graph manager #138

Merged
merged 1 commit into from
Mar 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 44 additions & 4 deletions test/test_graph_manager.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,49 @@
"""Tests for the graph_manager module (to be done)."""

# TODO: to be implemented
from graph_manager import BayesianGraph as g
import logging
import config


logger = logging.getLogger(config.APP_NAME)


def test_execute_invalid_query():
"""Test execution of invalid query."""
invalid_query = "g.count"

status, data = g.execute(invalid_query)
logger.info([status, data])
assert status is False
assert "No such property: count for class:" in data["message"]


def test_return_json_response_data():
"""Test valid respone is returned from graph db."""
query = "g.V().count()"
status, data = g.execute(query)
logger.info([status, data])
assert status is True
r = g.return_json_response_data(data)
logger.info(r)
assert r >= 0


def test_is_index_created():
"""Test validity created index."""
status = g.is_index_created()
logger.info(status)
assert status is False


def test_is_schema_defined():
"""Test if schema was initialized correctly."""
status = g.is_schema_defined()
logger.info(status)
assert status is True

from graph_manager import BayesianGraph
import pytest

if __name__ == '__main__':
pass
test_execute_invalid_query()
test_return_json_response_data()
test_is_index_created()