-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathtest_auth_host_e2e.py
More file actions
42 lines (33 loc) · 1.36 KB
/
Copy pathtest_auth_host_e2e.py
File metadata and controls
42 lines (33 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# ---------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------------------------------------------
"""Authentication host E2E coverage."""
import os
import pytest
import pytest_asyncio
from .testharness import E2ETestContext
@pytest_asyncio.fixture(loop_scope="module")
async def ctx(request):
context = E2ETestContext()
await context.setup()
yield context
await context.teardown(
test_failed=request.session.stash.get("any_test_failed", False)
or bool(os.environ.get("GITHUB_ACTIONS"))
)
@pytest.mark.asyncio(loop_scope="module")
@pytest.mark.parametrize(
("copilot_host", "gh_host", "expected_host"),
[
("tenant.ghe.example", "fallback.ghe.example", "https://tenant.ghe.example"),
("", "fallback.ghe.example", "https://fallback.ghe.example"),
("", "", "https://github.com"),
],
)
async def test_should_report_selected_github_auth_host(ctx, copilot_host, gh_host, expected_host):
ctx.add_runtime_env("COPILOT_GH_HOST", copilot_host)
ctx.add_runtime_env("GH_HOST", gh_host)
await ctx.client.start()
status = await ctx.client.get_auth_status()
assert status.isAuthenticated, status.statusMessage
assert status.host == expected_host