-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac17315
commit 702923d
Showing
1 changed file
with
27 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,27 @@ | ||
import unittest | ||
from scripts.changed_files import changed_files | ||
|
||
|
||
class TestGetChangedFiles(unittest.TestCase): | ||
|
||
def test_no_files(self): | ||
self.assertCountEqual(changed_files.get_changed_files([]), []) | ||
|
||
def test_no_matching_services(self): | ||
files = ["other-service/file.txt", "another-service/anotherfile.txt"] | ||
self.assertCountEqual(changed_files.get_changed_files(files), []) | ||
|
||
def test_some_matching_services(self): | ||
files = ["auth-service/file1.txt", "order-service/file2.txt", "unrelated/file3.txt"] | ||
self.assertCountEqual(changed_files.get_changed_files(files), ["auth-service", "order-service"]) | ||
|
||
def test_all_matching_services(self): | ||
files = ["auth-service/file1.txt", "sneaker-service/file2.txt", "order-service/file3.txt"] | ||
self.assertCountEqual(changed_files.get_changed_files(files), ["auth-service", "sneaker-service", "order-service"]) | ||
|
||
def test_duplicate_services(self): | ||
files = ["auth-service/file1.txt", "auth-service/file2.txt"] | ||
self.assertCountEqual(changed_files.get_changed_files(files), ["auth-service"]) | ||
|
||
if __name__ == "__main__": | ||
unittest.main() |