Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions robotpageobjects/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,9 @@ def _resolve_url(self, *args):
self.uri_vars = uri_vars
return uritemplate.expand(self.baseurl + self.uri, uri_vars)
else:
if uri_type == 'template':
raise exceptions.UriResolutionError('%s has uri template %s , but no arguments were given to resolve it' %
(pageobj_name, self.uri))
# the user wants to open the default uri
return self.baseurl + self.uri

Expand Down
8 changes: 8 additions & 0 deletions tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,14 @@ def test_too_many_vars_passed_to_uri_template_in_robot(self):
po._is_robot = True
po._resolve_url("pid=foo", "bar=baz")

@raises(exceptions.UriResolutionError)
def test_no_vars_passed_to_uri_template(self):
"""There is a template but no variables are possed in."""

self.set_baseurl_env(base_file=False, arbitrary_base="http://www.ncbi.nlm.nih.gov")
self.PO.uri_template = "/pubmed/{pid}"
self.PO()._resolve_url()

@raises(exceptions.UriResolutionError)
def test_wrong_var_name_in_robot(self):
self.set_baseurl_env()
Expand Down