-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added simple test for analytics availability (#4308)
Co-authored-by: kirill-sizov <[email protected]>
- Loading branch information
Andrey Zhavoronkov
and
kirill-sizov
authored
Feb 16, 2022
1 parent
a676862
commit 3c8922e
Showing
4 changed files
with
50 additions
and
5 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
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright (C) 2022 Intel Corporation | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
import pytest | ||
from http import HTTPStatus | ||
from .utils.config import server_get | ||
|
||
class TestGetAnalytics: | ||
endpoint = 'analytics/app/kibana' | ||
def _test_can_see(self, user): | ||
response = server_get(user, self.endpoint) | ||
|
||
assert response.status_code == HTTPStatus.OK | ||
|
||
def _test_cannot_see(self, user): | ||
response = server_get(user, self.endpoint) | ||
|
||
assert response.status_code == HTTPStatus.FORBIDDEN | ||
|
||
@pytest.mark.parametrize('privilege, is_allow', [ | ||
('admin', True), ('business', True), | ||
('worker', False), ('user', False) | ||
]) | ||
def test_can_see(self, privilege, is_allow, find_users): | ||
user = find_users(privilege=privilege)[0]['username'] | ||
|
||
if is_allow: | ||
self._test_can_see(user) | ||
else: | ||
self._test_cannot_see(user) |
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