Skip to content

Commit

Permalink
enable search tests (DefectDojo#3495)
Browse files Browse the repository at this point in the history
* enable search tests

* enable search tests

* enable search tests

* enable search tests
  • Loading branch information
valentijnscholten authored Dec 19, 2020
1 parent 58ad5aa commit 06e5eaf
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 37 deletions.
16 changes: 8 additions & 8 deletions docker/entrypoint-integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ else
fail $test
fi

# all smoke tests are already covered by other testcases above/below
# test="Smoke integration test"
# echo "Running: $test"
# if python3 tests/smoke_test.py ; then
# success $test
# else
# fail $test
# fi

test="Search integration test"
echo "Running: $test"
if python3 tests/search_test.py ; then
success $test
else
fail $test
fi

test="Check Status test"
echo "Running: $test"
Expand Down
2 changes: 1 addition & 1 deletion entrypoint_scripts/test/travis-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ travis_fold end travis_integration_install
travis_fold start travis_integration_tests

python tests/check_status.py -v
python tests/smoke_test.py
python tests/search_test.py
python tests/dedupe_unit_test.py

travis_fold end travis_integration_tests
Expand Down
2 changes: 1 addition & 1 deletion setup/scripts/test/travis-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ travis_fold end travis_integration_install
travis_fold start travis_integration_tests

python tests/check_status.py -v
python tests/smoke_test.py
python tests/search_test.py
python tests/dedupe_unit_test.py

travis_fold end travis_integration_tests
Expand Down
4 changes: 4 additions & 0 deletions tests/base_test_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,16 @@ def login_page(self):
def goto_some_page(self):
driver = self.driver
driver.get(self.base_url + "user")
return driver

def goto_product_overview(self, driver):
driver.get(self.base_url + "product")
self.wait_for_datatable_if_content("no_products", "products_wrapper")
return driver

def goto_component_overview(self, driver):
driver.get(self.base_url + "components")
return driver

def goto_active_engagements_overview(self, driver):
# return self.goto_engagements_internal(driver, 'engagement')
Expand All @@ -104,6 +107,7 @@ def goto_engagements_internal(self, driver, rel_url):
def goto_all_findings_list(self, driver):
driver.get(self.base_url + "finding")
self.wait_for_datatable_if_content("no_findings", "open_findings_wrapper")
return driver

def wait_for_datatable_if_content(self, no_content_id, wrapper_id):
no_content = None
Expand Down
5 changes: 2 additions & 3 deletions tests/local-integration-tests.bat
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ echo "Running Ibm Appscan integration test"
python tests/ibm_appscan_test.py
if %ERRORLEVEL% NEQ 0 GOTO END

everything in the smoke test is already covered by the other tests
echo "Running Smoke integration test"
python tests/smoke_test.py
echo "Running Search integration test"
python tests/search_test.py
if %ERRORLEVEL% NEQ 0 GOTO END

echo "Running Check Status test"
Expand Down
15 changes: 7 additions & 8 deletions tests/local-integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,13 @@ else
echo "Error: Report Builder integration test failed."; exit 1
fi

# everything in the smoke test is already covered by the other tests
# echo "Running Smoke integration test"
# if python3 tests/smoke_test.py ; then
# echo "Success: Smoke integration tests passed"
# else
# docker-compose logs uwsgi --tail=120
# echo "Error: Smoke integration test failed"; exit 1
# fi
echo "Running Search integration test"
if python3 tests/search_test.py ; then
echo "Success: Search integration tests passed"
else
docker-compose logs uwsgi --tail=120
echo "Error: Search integration test failed"; exit 1
fi

echo "Running Check Status test"
if python3 tests/check_status.py ; then
Expand Down
28 changes: 14 additions & 14 deletions tests/search_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
from base_test_class import BaseTestCase


class DojoTests(BaseTestCase):
class SearchTests(BaseTestCase):

def test_login(self):
driver = self.login_page()

def test_search(self):
# very basic search test to see if it doesn't 500
driver = self.goto_some_page()
driver.find_element_by_id("simple_search").clear()
driver.find_element_by_id("simple_search").send_keys('finding')
driver.find_element_by_id("simple_search_submit").click()
Expand Down Expand Up @@ -91,19 +92,18 @@ def test_search_id(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(DojoTests('test_login'))
suite.addTest(DojoTests('test_search'))
suite.addTest(DojoTests('test_search_cve'))
suite.addTest(DojoTests('test_search_tag'))
suite.addTest(DojoTests('test_search_product_tag'))
suite.addTest(DojoTests('test_search_engagement_tag'))
suite.addTest(DojoTests('test_search_test_tag'))
suite.addTest(DojoTests('test_search_tags'))
suite.addTest(DojoTests('test_search_product_tags'))
suite.addTest(DojoTests('test_search_engagement_tags'))
suite.addTest(DojoTests('test_search_test_tags'))
suite.addTest(DojoTests('test_search_id'))
test_search_product_tag
suite.addTest(SearchTests('test_login'))
suite.addTest(SearchTests('test_search'))
suite.addTest(SearchTests('test_search_cve'))
suite.addTest(SearchTests('test_search_tag'))
suite.addTest(SearchTests('test_search_product_tag'))
suite.addTest(SearchTests('test_search_engagement_tag'))
suite.addTest(SearchTests('test_search_test_tag'))
suite.addTest(SearchTests('test_search_tags'))
suite.addTest(SearchTests('test_search_product_tags'))
suite.addTest(SearchTests('test_search_engagement_tags'))
suite.addTest(SearchTests('test_search_test_tags'))
suite.addTest(SearchTests('test_search_id'))
return suite


Expand Down
4 changes: 2 additions & 2 deletions travis/integration_test-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ else
fail $test
fi

test="Smoke integration test"
test="Search integration test"
echo "Running: $test"
if python3 tests/smoke_test.py ; then
if python3 tests/search_test.py ; then
success $test
else
fail $test
Expand Down

0 comments on commit 06e5eaf

Please sign in to comment.