Skip to content

Standardize test base class inheritance. Closes #700#714

Merged
regulartim merged 1 commit intointelowlproject:developfrom
RaviTeja799:fix/standardize-test-base-classes
Jan 19, 2026
Merged

Standardize test base class inheritance. Closes #700#714
regulartim merged 1 commit intointelowlproject:developfrom
RaviTeja799:fix/standardize-test-base-classes

Conversation

@RaviTeja799
Copy link
Copy Markdown
Contributor

Description

Standardized all tests to inherit from CustomTestCase or ExtractionTestCase as defined in tests/init.py, addressing the inconsistent inheritance pattern across the test suite.

Changes Made

  • Changed SimpleTestCase to CustomTestCase in test_ntfy.py and test_rf_config.py
  • Changed TestCase to CustomTestCase in test_serializers.py (also updated setUpClass → setUpTestData with proper super() call)
  • Changed unittest.TestCase to ExtractionTestCase in test_cowrie_extraction.py
  • Changed unittest.TestCase to CustomTestCase in test_monitor_logs.py

Related issues

Closes #700

Type of change

  • Bug fix (non-breaking change which fixes an issue).

Checklist

  • I have read and understood the rules about how to Contribute to this project.
  • The pull request is for the branch develop.
  • I have added documentation of the new features.
  • Linters (Black, Flake, Isort) gave 0 errors.
  • I have added tests for the feature/bug I solved. All the tests (new and old ones) gave 0 errors.
  • If changes were made to an existing model/serializer/view, the docs were updated and regenerated.
  • If the GUI has been modified:
    • I have a provided a screenshot of the result in the PR.
    • I have created new frontend tests for the new component or updated existing ones.

Copilot AI review requested due to automatic review settings January 17, 2026 04:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request standardizes test base class inheritance across the test suite by ensuring all tests inherit from either CustomTestCase or ExtractionTestCase as defined in tests/__init__.py, addressing inconsistent test inheritance patterns identified in issue #700.

Changes:

  • Replaced SimpleTestCase with CustomTestCase in ntfy and RF config tests
  • Replaced TestCase with CustomTestCase in serializer tests and updated setUpClass to setUpTestData
  • Replaced unittest.TestCase with ExtractionTestCase in cowrie extraction tests and CustomTestCase in monitor logs tests

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/test_serializers.py Changed from Django's TestCase to CustomTestCase, migrated setUpClass to setUpTestData with proper super() call, added logic to check for existing adbhoney honeypot
tests/test_rf_config.py Changed from SimpleTestCase to CustomTestCase, reformatted class_weight parameter logic for readability
tests/test_ntfy.py Changed from SimpleTestCase to CustomTestCase, reformatted long function calls for better line length compliance
tests/test_cowrie_extraction.py Changed from unittest.TestCase to ExtractionTestCase, reformatted imports and long lines for style compliance
tests/greedybear/cronjobs/test_monitor_logs.py Changed from unittest.TestCase to CustomTestCase, reformatted long string for better line length compliance

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings January 17, 2026 04:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@RaviTeja799 RaviTeja799 force-pushed the fix/standardize-test-base-classes branch from 5e7a4af to cf5d851 Compare January 17, 2026 04:19
Copy link
Copy Markdown
Collaborator

@regulartim regulartim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! However you made some minor formatting changes (like splitting up single line commands to multiple lines). I would rather not have them in this PR. Or is there some strong reason for them?

@RaviTeja799
Copy link
Copy Markdown
Contributor Author

Hi @regulartim The extra formatting changes came from running Black.(as mentioned in Contribution guidelines to use linters like blake flake8 and isort. I can make a minimal commit with just the inheritance changes if you'd prefer and undo the unsual formatting.
Let me know what needs to be done

@regulartim
Copy link
Copy Markdown
Collaborator

Hey @RaviTeja799 ! :) We recently switched to Ruff. The contribution guidelines are already updated, but the PR template still mentions the old linters. As I said, I would prefer a PR just with the inheritance changes.

Copilot AI review requested due to automatic review settings January 18, 2026 13:57
@RaviTeja799 RaviTeja799 force-pushed the fix/standardize-test-base-classes branch from cf5d851 to a3d2369 Compare January 18, 2026 13:57
@RaviTeja799
Copy link
Copy Markdown
Contributor Author

Hi @regulartim! Thanks for the feedback!

I've updated the PR with minimal changes as requested - only the import and class inheritance changes.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

tests/test_cowrie_extraction.py:85

  • The setUp method should call super().setUp() to ensure proper initialization of the parent ExtractionTestCase class. While the current code works because it's recreating the same mock objects, not calling super() could lead to issues if the parent class setUp is extended in the future.
    def setUp(self):
        """Set up test fixtures."""
        self.mock_ioc_repo = Mock()
        self.mock_sensor_repo = Mock()
        self.mock_session_repo = Mock()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@regulartim
Copy link
Copy Markdown
Collaborator

Hey @RaviTeja799 ! Looks good now, thanks for your work!

@regulartim regulartim merged commit e72f505 into intelowlproject:develop Jan 19, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants