Skip to content

Commit 3ed0d61

Browse files
author
Joshua B. Smith
committed
Size for environments was not correct
Sizes can be 0, 1, 2, or 3 originally the size param excluded 0 (which is the free tier). Now this is included.
1 parent b35391e commit 3ed0d61

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

test/test_discovery_v1.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import json
44
import watson_developer_cloud
5+
import pytest
56
try:
67
from urllib.parse import urlparse, urljoin
78
except ImportError:
@@ -112,14 +113,12 @@ def test_create_environment():
112113

113114
assert thrown
114115

115-
try:
116+
with pytest.raises(ValueError):
116117
discovery.create_environment(size=14)
117-
except ValueError as ve:
118-
thrown = True
119-
assert str(ve) == "Size can be 1, 2, or 3"
120118

121-
assert thrown
122-
assert len(responses.calls) == 2
119+
discovery.create_environment(size=0)
120+
121+
assert len(responses.calls) == 3
123122

124123

125124
@responses.activate

watson_developer_cloud/discovery_v1.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ def create_environment(self, name="", description="", size=1):
7878
:return:
7979
"""
8080
self._valid_name_and_description(name=name, description=description)
81-
if size not in range(1, 4):
82-
raise ValueError("Size can be 1, 2, or 3")
81+
if size not in range(0, 4):
82+
raise ValueError("Size can be 0, 1, 2, or 3")
8383

8484
body = json.dumps({"name": name,
8585
"description": description,

0 commit comments

Comments
 (0)