-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Require site_url only for token login
- Loading branch information
Showing
2 changed files
with
19 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -284,7 +284,21 @@ def test_root(self): | |
root = session.root | ||
assert root == api_root | ||
|
||
def test_require_host(self): | ||
def test_root_no_site_url(self): | ||
email = "[email protected]" | ||
session = elements.ElementSession(email=email, password="abx") | ||
with self.assertRaises(ValueError) as err: | ||
_ = session.root | ||
assert str(err.exception) == "Session must be initialized with `site_url`" | ||
|
||
def test_require_host_with_token(self): | ||
with self.assertRaises(ValueError) as err: | ||
elements.ElementSession(token="abc") | ||
assert str(err.exception) == "Must include a `site_url` host to connect to" | ||
|
||
def test_host_not_required_on_email(self): | ||
email = "[email protected]" | ||
session = elements.ElementSession(email=email, password="abx") | ||
assert session.site_url is None | ||
assert session.email is email | ||
|