33import unittest
44import re
55import sys
6+ import os
67
78
89class ProductTest (unittest .TestCase ):
910 def setUp (self ):
1011 # Initialize the driver
12+ # When used with Travis, chromdriver is stored in the same
13+ # directory as the unit tests
1114 self .driver = webdriver .Chrome ('chromedriver' )
1215 # Allow a little time for the driver to initialize
1316 self .driver .implicitly_wait (30 )
1417 # Set the base address of the dojo
15- self .base_url = "http://localhost:8080 /"
18+ self .base_url = "http://localhost:8000 /"
1619 self .verificationErrors = []
1720 self .accept_next_alert = True
1821
@@ -23,12 +26,12 @@ def login_page(self):
2326 driver .get (self .base_url + "login" )
2427 # Good practice to clear the entry before typing
2528 driver .find_element_by_id ("id_username" ).clear ()
26- # Set the user to an admin account
27- driver .find_element_by_id ("id_username" ).send_keys ('admin' )
29+ # These credentials will be used by Travis when testing new PRs
30+ # They will not work when testing on your own build
31+ # Be sure to change them before submitting a PR
32+ driver .find_element_by_id ("id_username" ).send_keys (os .environ ['DD_ADMIN_USER' ])
2833 driver .find_element_by_id ("id_password" ).clear ()
29- # Use the password unqiue to the container. Info on finding this below
30- # https://github.com/DefectDojo/django-DefectDojo/blob/master/DOCKER.md
31- driver .find_element_by_id ("id_password" ).send_keys ('eE1F6IKz3Uq4rLg6aYtI0k' )
34+ driver .find_element_by_id ("id_password" ).send_keys (os .environ ['DD_ADMIN_PASSWORD' ])
3235 # "Click" the but the login button
3336 driver .find_element_by_css_selector ("button.btn.btn-success" ).click ()
3437 return driver
0 commit comments