Coverage for tests / integration / test_core.py: 0%
39 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-18 23:20 -0400
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-18 23:20 -0400
1import unittest
2from graphqler import core
3from graphqler.utils.config_handler import parse_config
4from tests.integration.utils.run_api import run_node_project, wait_for_server
5import os
8class TestCore(unittest.TestCase):
9 PORT = 4001
10 URL = f"http://localhost:{PORT}/graphql"
11 PATH = "ci-test-user-wallet-api/"
12 API_PATH = "tests/test-apis/user-wallet-api"
13 CONFIG_PATH = "tests/test-apis/test_configs/user_wallet_api_config.toml"
14 process = None
15 process_pid = None
17 @classmethod
18 def setUpClass(cls):
19 # Start the GrapQL server
20 cls.process = run_node_project(cls.API_PATH, [], str(cls.PORT))
21 cls.process_pid = cls.process.pid
23 # Wait for the server to to respond
24 wait_for_server(cls.URL, timeout=30)
26 @classmethod
27 def tearDownClass(cls):
28 if cls.process and cls.process.pid == cls.process_pid:
29 cls.process.kill()
30 cls.process.wait()
31 os.system(f"rm -rf {cls.PATH}")
33 def test_core_functions(self):
34 newconfig = parse_config(self.CONFIG_PATH)
35 result = core.compile_and_fuzz(self.PATH, self.URL, newconfig)
36 objects_bucket: core.ObjectsBucket = result["objects_bucket"]
37 api: core.API = result['api']
38 stats: core.Stats = result["stats"]
39 results = result["results"]
41 assert not objects_bucket.is_empty()
42 assert api.get_num_objects() > 0
43 assert api.get_num_queries() > 0
44 assert api.get_num_mutations() > 0
45 assert stats.number_of_objects > 0
46 assert stats.number_of_successes > 0
47 assert stats.number_of_objects > 0
48 assert len(results) > 0