forked from kernelci/kernelci-api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_count_handler.py
44 lines (36 loc) · 1.2 KB
/
test_count_handler.py
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
43
44
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# Copyright (C) 2023 Collabora Limited
# Author: Jeny Sadadia <jeny.sadadia@collabora.com>
"""End-to-end test functions for KernelCI API count handler"""
import pytest
@pytest.mark.asyncio
@pytest.mark.dependency(
depends=[
'e2e_tests/test_pipeline.py::test_node_pipeline'],
scope='session')
async def test_count_nodes(test_async_client):
"""
Test Case : Test KernelCI API GET /count endpoint
Expected Result :
HTTP Response Code 200 OK
Total number of nodes available
"""
response = await test_async_client.get("count")
assert response.status_code == 200
assert response.json() >= 0
@pytest.mark.asyncio
@pytest.mark.dependency(
depends=[
'e2e_tests/test_pipeline.py::test_node_pipeline'],
scope='session')
async def test_count_nodes_matching_attributes(test_async_client):
"""
Test Case : Test KernelCI API GET /count endpoint with attributes
Expected Result :
HTTP Response Code 200 OK
Number of nodes matching attributes
"""
response = await test_async_client.get("count?name=checkout")
assert response.status_code == 200
assert response.json() >= 0