Skip to content

Commit

Permalink
Merge pull request #31 from kushwxha/setMaxFileSize-branch
Browse files Browse the repository at this point in the history
Added unit tests for setMaxFileSize method in FileFilter class Fixes #13
  • Loading branch information
Kota-Karthik authored Oct 2, 2024
2 parents 6b68279 + 9e140df commit 9c5faae
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/fileFilter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import pytest
from twinTrim.dataStructures.fileFilter import FileFilter

def test_set_max_file_size_valid():
"""Test setting valid max file size values."""
file_filter = FileFilter()

# Test with a smaller size
file_filter.setMaxFileSize("500mb")
assert file_filter.maxFileSize == "500mb", "Failed to set max file size to 500mb"

# Test with a larger size
file_filter.setMaxFileSize("2gb")
assert file_filter.maxFileSize == "2gb", "Failed to set max file size to 2gb"

# Test with a minimum size (edge case)
file_filter.setMaxFileSize("1kb")
assert file_filter.maxFileSize == "1kb", "Failed to set max file size to 1kb"

def test_set_max_file_size_same_value():
"""Test setting the same max file size."""
file_filter = FileFilter()

# Test setting the max file size to the default value
file_filter.setMaxFileSize("1gb")
assert file_filter.maxFileSize == "1gb", "Failed to set max file size to 1gb"

def test_set_max_file_size_boundary():
"""Test boundary values for max file size."""
file_filter = FileFilter()

# Test setting a value just under the default
file_filter.setMaxFileSize("999mb")
assert file_filter.maxFileSize == "999mb", "Failed to set max file size to 999mb"

def test_set_max_file_size_empty_value():
"""Test setting an empty value to max file size."""
file_filter = FileFilter()

# Since there is no validation, an empty value would still set it to the empty string
file_filter.setMaxFileSize("")
assert file_filter.maxFileSize == "", "Failed to set max file size to empty value"

0 comments on commit 9c5faae

Please sign in to comment.