Skip to content

Commit c3a84a8

Browse files
Merge pull request #786 from adamtheturtle/targets-same-name
Add test for custom base URL
2 parents 11f92c9 + 6c578b6 commit c3a84a8

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

spelling_private_dict.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ noqa
3939
plugins
4040
png
4141
pragma
42+
py
4243
pytest
4344
readme
4445
readthedocs

tests/test_add_target.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
import io
66

7+
from mock_vws import MockVWS
8+
79
from vws import VWS
810

911

@@ -32,3 +34,28 @@ def test_add_two_targets(
3234
"""
3335
client.add_target(name='x', width=1, image=high_quality_image)
3436
client.add_target(name='a', width=1, image=high_quality_image)
37+
38+
39+
class TestCustomBaseURL:
40+
"""
41+
Tests for adding images to databases under custom VWS URLs.
42+
"""
43+
44+
def test_custom_base_url(self, high_quality_image: io.BytesIO) -> None:
45+
"""
46+
It is possible to use add a target to a database under a custom VWS
47+
URL.
48+
"""
49+
base_vws_url = 'http://example.com'
50+
with MockVWS(base_vws_url=base_vws_url) as mock:
51+
client = VWS(
52+
server_access_key=mock.server_access_key,
53+
server_secret_key=mock.server_secret_key,
54+
base_vws_url=base_vws_url,
55+
)
56+
57+
client.add_target(
58+
name='x',
59+
width=1,
60+
image=high_quality_image,
61+
)

0 commit comments

Comments
 (0)