Skip to content

Commit 0c8e5d3

Browse files
committed
Changes into config.py
- Added get_path() function to get paths inside the repository - Added jsondump() function to dump json files with pretty print - Changed live site target URL to https -
1 parent 5cfc8c0 commit 0c8e5d3

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

codebender_testing/config.py

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,26 @@
44
from selenium.webdriver import chrome
55
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
66
import yaml
7+
import simplejson
78

89

910
def _rel_path(*args):
1011
"""Forms a path relative to this file's directory."""
1112
return os.path.join(os.path.dirname(__file__), *args)
1213

14+
def get_path(directory, filename=None):
15+
path = os.path.join(os.path.dirname( __file__ ), '..', directory)
16+
if filename:
17+
path = os.path.join(os.path.dirname( __file__ ), '..', directory, filename)
18+
return os.path.abspath(path)
19+
20+
def jsondump(data):
21+
return simplejson.dumps(data, sort_keys=True, indent=4 * ' ')
22+
1323
# URL of the default site to be used for testing
1424
BASE_URL = "http://localhost"
1525
# URL of the actual Codebender website
16-
LIVE_SITE_URL = "http://codebender.cc"
26+
LIVE_SITE_URL = "https://codebender.cc"
1727

1828
# Names of sources (i.e. repositories) used to generate the codebender site.
1929
SOURCE_BACHELOR = 'bachelor'
@@ -47,12 +57,23 @@ def _rel_path(*args):
4757

4858
# Files used for testing
4959
TEST_DATA_DIR = _rel_path('..', 'test_data')
50-
TEST_DATA_BLANK_PROJECT = os.path.join(TEST_DATA_DIR, 'blank_project.ino')
51-
TEST_DATA_BLANK_PROJECT_ZIP = os.path.join(TEST_DATA_DIR, 'blank_project.zip')
60+
TEST_DATA_INO = os.path.join(TEST_DATA_DIR, 'upload_ino.ino')
61+
TEST_DATA_ZIP = os.path.join(TEST_DATA_DIR, 'upload_zip.zip')
5262

5363
# Directory in which the local compile tester files are stored.
5464
COMPILE_TESTER_DIR = os.path.join(TEST_DATA_DIR, 'cb_compile_tester')
5565

66+
# Credentials to use when logging into the bachelor site
67+
TEST_CREDENTIALS = {
68+
"username": "tester",
69+
"password": "testerPASS"
70+
}
71+
72+
TEST_PROJECT_NAME = "test_project"
73+
74+
TIMEOUT = {
75+
'LOCATE_ELEMENT': 30
76+
}
5677

5778
# Set up Selenium Webdrivers to be used for selenium tests
5879
def _get_firefox_profile():
@@ -129,15 +150,3 @@ def create_webdriver(command_executor, desired_capabilities):
129150
desired_capabilities=desired_capabilities,
130151
browser_profile=browser_profile,
131152
)
132-
133-
134-
# Credentials to use when logging into the bachelor site
135-
TEST_CREDENTIALS = {
136-
"username": "tester",
137-
"password": "testerPASS"
138-
}
139-
140-
TEST_PROJECT_NAME = "test_project"
141-
142-
# How long we wait until giving up on trying to locate an element
143-
ELEMENT_FIND_TIMEOUT = 10

0 commit comments

Comments
 (0)