You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
980 B
Python
34 lines
980 B
Python
# Copyright (C) 2022 Intel Corporation
|
|
# Copyright (C) 2022 CVAT.ai Corporation
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
import pytest
|
|
from http import HTTPStatus
|
|
from shared.utils.config import server_get
|
|
|
|
@pytest.mark.usefixtures('dontchangedb')
|
|
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)
|