|
24 | 24 | else f"http://{keycloak_service}:8080"
|
25 | 25 | )
|
26 | 26 |
|
27 |
| -if nifi_version in ["2.0.0-M4"]: |
| 27 | +# startswith instead of an exact check to |
| 28 | +# a) hit all 2.x versions and |
| 29 | +# b) to allow for custom images because `nifi_version` will contain the whole custom image string |
| 30 | +# e.g. 2.0.0-M4,localhost:5000/stackable/nifi:2.0.0-M4-stackable0.0.0-dev |
| 31 | +if not nifi_version.startswith("1."): |
28 | 32 | auth_config_page = session.get(
|
29 | 33 | f"https://{nifi}:8443/nifi-api/authentication/configuration",
|
30 | 34 | verify=False,
|
31 |
| - headers={"Content-type": "application/json"} |
| 35 | + headers={"Content-type": "application/json"}, |
32 | 36 | )
|
33 | 37 | assert auth_config_page.ok, "Could not fetch auth config from NiFi"
|
34 | 38 | auth_config = json.loads(auth_config_page.text)
|
|
44 | 48 | )
|
45 | 49 |
|
46 | 50 | print("actual: ", login_page.url)
|
47 |
| -print("expected: ", f"{keycloak_base_url}/realms/test/protocol/openid-connect/auth?response_type=code&client_id=nifi&scope=") |
| 51 | +print( |
| 52 | + "expected: ", |
| 53 | + f"{keycloak_base_url}/realms/test/protocol/openid-connect/auth?response_type=code&client_id=nifi&scope=", |
| 54 | +) |
48 | 55 | assert login_page.ok, "Redirection from NiFi to Keycloak failed"
|
49 | 56 | assert login_page.url.startswith(
|
50 | 57 | f"{keycloak_base_url}/realms/test/protocol/openid-connect/auth?response_type=code&client_id=nifi&scope="
|
|
54 | 61 | login_page_html = BeautifulSoup(login_page.text, "html.parser")
|
55 | 62 | authenticate_url = login_page_html.form["action"]
|
56 | 63 | welcome_page = session.post(
|
57 |
| - authenticate_url, data={"username": "jane.doe", "password": "T8mn72D9"}, verify=False |
| 64 | + authenticate_url, |
| 65 | + data={"username": "jane.doe", "password": "T8mn72D9"}, |
| 66 | + verify=False, |
58 | 67 | )
|
59 | 68 | assert welcome_page.ok, "Login failed"
|
60 | 69 | assert (
|
|
0 commit comments