Skip to content

Commit

Permalink
Provide Unit Test For Displaying Statistics Feature (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
shachar2000 authored and Daniel Kallner committed Oct 8, 2024
1 parent 0d78c34 commit bc7e656
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test_statistic.py
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

0 comments on commit bc7e656

Please sign in to comment.