-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide Unit Test For Displaying Statistics Feature (#28)
- Loading branch information
1 parent
0d78c34
commit bc7e656
Showing
1 changed file
with
24 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# ------------------------------------------ Test intro ------------------------------------------ # | ||
# The test verifies that the calculate_percentages method correctly calculates and returns the | ||
# percentage distribution of images in a Kubernetes cluster (kind-cluster1). It ensures the output | ||
# consists of strings, integers, and floats in the expected format. | ||
# ------------------------------------------ Test intro ------------------------------------------ # | ||
|
||
from src.disko.image_collector import * | ||
|
||
# Create db from cluster | ||
create_db = ImageCollector().collect_images("kind-cluster1") | ||
|
||
# Import image_controller.py to use any function on my db file | ||
ctl1 = ImageController("image_data.db") | ||
|
||
|
||
# Testing the calculation of the percentages of the images | ||
def test_calculate_percentages(): | ||
output = ctl1.calculate_percentages("kind-cluster1") | ||
print(output) | ||
for item in output: | ||
if not isinstance(item[0], str): assert False | ||
if not isinstance(item[1], int): assert False | ||
if not isinstance(item[2], float): assert False | ||
assert True |