-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add full integration test with hubtraf
- Fully simulates what a user would be doing - Also tests tljh-config set and reload functionality
- Loading branch information
Showing
3 changed files
with
30 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pytest | ||
requests | ||
pytest-asyncio | ||
git+https://github.com/yuvipanda/hubtraf.git |
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 |
---|---|---|
@@ -1,5 +1,26 @@ | ||
import requests | ||
from hubtraf.user import User | ||
from hubtraf.auth.dummy import login_dummy | ||
import secrets | ||
from functools import partial | ||
import pwd | ||
|
||
|
||
def test_hub_up(): | ||
r = requests.get('http://127.0.0.1') | ||
r.raise_for_status() | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_user_login(): | ||
hub_url = 'http://127.0.0.1' | ||
username = secrets.token_hex(16) | ||
|
||
async with User(username, hub_url, partial(login_dummy, password='')) as u: | ||
await u.login() | ||
await u.ensure_server() | ||
await u.start_kernel() | ||
await u.assert_code_output("5 * 4", "20", 5, 5) | ||
|
||
# Assert that the user exists | ||
assert pwd.getpwnam(f'jupyter-{username}') is not None |