Skip to content

Commit

Permalink
Remove unused autogen tests and add cli tests (#1371)
Browse files Browse the repository at this point in the history
* Remove unused autogen tests and add cli tests

* Update dependency

* Updates to gh actions
  • Loading branch information
jleaniz authored Oct 16, 2023
1 parent 41f3fac commit 0c9ca23
Show file tree
Hide file tree
Showing 62 changed files with 10 additions and 1,620 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
- name: Install and configure test dependencies
run: |
docker exec -u root -t turbinia-worker bash -c "/usr/bin/python -m pip install --quiet --upgrade pip"
docker exec -u root -t turbinia-worker bash -c "cd /tmp/turbinia/api/client && /usr/bin/python -m pip install --quiet ."
docker exec -u root -t turbinia-worker bash -c "/usr/bin/python -m pip install --quiet -r /tmp/turbinia/api/cli/requirements.txt"
docker exec -u root -t turbinia-worker bash -c "/usr/bin/python -m pip install --quiet mock nose coverage yapf"
docker exec -u root -t turbinia-worker bash -c "/usr/bin/python -m pip install --quiet tox"
- name: Run Tests
Expand Down
2 changes: 2 additions & 0 deletions run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

if __name__ == '__main__':
test_suite = unittest.TestLoader().discover('turbinia', pattern='*_test.py')
test_suite.addTests(
unittest.TestLoader().discover('turbinia/api/cli', pattern='*_test.py'))
test_results = unittest.TextTestRunner(verbosity=2).run(test_suite)
if not test_results.wasSuccessful():
sys.exit(1)
9 changes: 6 additions & 3 deletions turbinia/api/cli/turbinia_client/turbiniacli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import unittest
import mock
import pathlib

from turbinia_client.turbiniacli import TurbiniaCli
from fastapi.testclient import TestClient
Expand All @@ -29,7 +30,9 @@ class TestTurbiniaCli(unittest.TestCase):
def setUp(self) -> None:
"""Sets up the client for the tests."""
self.api_client = TestClient(app)
self.client = TurbiniaCli(config_instance='default', config_path='../')
config_path = pathlib.Path(__file__).parent.parent
self.client = TurbiniaCli(
config_instance='default', config_path=config_path)

def testInitialization(self) -> None:
"""Tests if the client was initialized properly."""
Expand All @@ -46,11 +49,11 @@ def testReadConfiguration(self) -> None:
self.assertIn('CREDENTIALS_FILENAME', self.client.config_dict)

@mock.patch(
'turbinia_api_lib.api.turbinia_configuration_api.TurbiniaConfigurationApi.get_evidence_types'
'turbinia_api_lib.api.turbinia_evidence_api.TurbiniaEvidenceApi.get_evidence_types'
)
def testGetEvidenceArguments(self, mock_response) -> None:
"""Tests the get_evidence_arguments method."""
test_response = self.api_client.get('/api/config/evidence')
test_response = self.api_client.get('/api/evidence/types')
mock_response.return_value = test_response
api_response = self.client.get_evidence_arguments()
self.assertEqual(test_response, api_response)
Expand Down
Empty file.
35 changes: 0 additions & 35 deletions turbinia/api/client/test/test_base_request_options.py

This file was deleted.

This file was deleted.

67 changes: 0 additions & 67 deletions turbinia/api/client/test/test_complete_turbinia_stats.py

This file was deleted.

37 changes: 0 additions & 37 deletions turbinia/api/client/test/test_http_validation_error.py

This file was deleted.

51 changes: 0 additions & 51 deletions turbinia/api/client/test/test_location_inner.py

This file was deleted.

Empty file.
25 changes: 0 additions & 25 deletions turbinia/api/client/test/test_models/test_base_request_options.py

This file was deleted.

This file was deleted.

25 changes: 0 additions & 25 deletions turbinia/api/client/test/test_models/test_http_validation_error.py

This file was deleted.

Loading

0 comments on commit 0c9ca23

Please sign in to comment.