Skip to content

Commit cebfc3a

Browse files
Merge pull request #76 from CartoDB/local_testing_configuration
Added HOST and PROTOCOL to test configuration, allowing local testing
2 parents 85093cf + 5d51e8c commit cebfc3a

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Feb-21-2018: version 1.2.0
2+
- Added PROTOCOL and HOST to test configuration allowing local testing.
3+
14
Dec-27-2017: version 1.1.2
25
- Fix on examples management of environment variables (#70)
36
- Fix onpremises tests (#70)

carto/datasets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def create(self, archive, interval=None, **import_args):
182182
import_job.refresh()
183183

184184
count = 0
185-
while import_job.state in ("enqueued", "pending", "uploading",
185+
while import_job.state in ("enqueued", "queued", "pending", "uploading",
186186
"unpacking", "importing", "guessing") \
187187
or (isinstance(manager, SyncTableJobManager)
188188
and import_job.state == "created"):

tests/conftest.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
77
from carto.users import UserManager
88
from mocks import MockRequests, NotMockRequests
99

10+
if "PROTOCOL" in os.environ:
11+
PROTOCOL = os.environ["PROTOCOL"]
12+
else:
13+
from secret import PROTOCOL
14+
15+
if "HOST" in os.environ:
16+
HOST = os.environ["HOST"]
17+
else:
18+
from secret import HOST
19+
1020
if "API_KEY" in os.environ:
1121
API_KEY = os.environ["API_KEY"]
1222
else:
@@ -42,13 +52,18 @@
4252
else:
4353
from secret import ONPREM_API_KEY
4454

45-
BASE_URL = "https://{organization}.carto.com/user/{user}/". \
46-
format(organization=ORGANIZATION,
55+
BASE_URL = "{protocol}://{organization}.{host}/user/{user}/". \
56+
format(protocol=PROTOCOL,
57+
host=HOST,
58+
organization=ORGANIZATION,
4759
user=USERNAME)
4860
ONPREMISES_USR_BASE_URL = "https://{onpremises}/user/{onpremuser}/". \
4961
format(onpremises=ONPREMISES,
5062
onpremuser=ONPREM_USERNAME)
51-
USR_BASE_URL = "https://{user}.carto.com/".format(user=USERNAME)
63+
USR_BASE_URL = "{protocol}://{user}.{host}/". \
64+
format(protocol=PROTOCOL,
65+
host=HOST,
66+
user=USERNAME)
5267

5368

5469
@pytest.fixture(scope="session")

tests/secret.py.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# Make sure you put the actual values in a file called secret.py
44

55
# CARTO account, please fill in
6+
PROTOCOL = "https"
7+
HOST = "carto.com"
68
ORGANIZATION = "mock-org"
79
USERNAME = "mock"
810
API_KEY = "mockmockmock"

0 commit comments

Comments
 (0)