diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..6f042e1 --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1 @@ +# Test package for keylogger-educational diff --git a/tests/test_basic.py b/tests/test_basic.py new file mode 100644 index 0000000..d9e1861 --- /dev/null +++ b/tests/test_basic.py @@ -0,0 +1,48 @@ +""" +Basic tests for the keylogger-educational project. +These tests verify the basic project structure and configuration. +""" + +import os +import pytest + + +@pytest.fixture +def project_root(): + """Return the project root directory path.""" + return os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +def test_project_structure(project_root): + """Test that the project has expected structure.""" + # Check essential files exist + assert os.path.exists(os.path.join(project_root, 'pyproject.toml')) + assert os.path.exists(os.path.join(project_root, 'README.md')) + assert os.path.exists(os.path.join(project_root, 'src')) + + +def test_src_package_structure(project_root): + """Test that the src package has expected files.""" + src_dir = os.path.join(project_root, 'src') + + assert os.path.exists(os.path.join(src_dir, '__init__.py')) + assert os.path.exists(os.path.join(src_dir, 'keylogger.py')) + assert os.path.exists(os.path.join(src_dir, 'server.py')) + + +def test_config_directory_exists(project_root): + """Test that the config directory exists.""" + assert os.path.exists(os.path.join(project_root, 'config')) + + +def test_version_file_exists(project_root): + """Test that VERSION file exists and contains valid version.""" + version_file = os.path.join(project_root, 'VERSION') + + assert os.path.exists(version_file) + + with open(version_file, 'r') as f: + version = f.read().strip() + + # Check version is not empty + assert len(version) > 0