Skip to content

Commit

Permalink
[tests] Test the name and sha512 cache modes.
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeShortCloud committed Oct 12, 2018
1 parent efa9805 commit ff8ab96
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,27 @@ def test_convert_merge(self):

remove(cards_merged_full_path)

def test_convert_single(self):
def test_convert_single(self, cache_mode=None):

if cache_mode == "name" or cache_mode == "sha512":
self.cgc.cache_mode = cache_mode

test_image_src = self.cgc.tmp_src_dir + "/single.jpg"
test_image_dest = self.cgc.tmp_dir_individual + "/single.jpg"
copyfile(self.cgc.tmp_src_dir + "/1.jpg", test_image_src)

if not self.cgc.convert_single(test_image_src):
self.assertTrue(False)
return False

remove(test_image_src)
remove(test_image_dest)
return True

def test_convert_single_cache(self):

for cache_mode in ["name", "sha512"]:
self.assertTrue(self.test_convert_single(cache_mode))

def test_convert_batch_directory(self):
return_status = self.cgc.convert_batch_directory(self.cards_source_dir)
Expand All @@ -163,6 +174,7 @@ def test_convert_batch_append_all(self):
elif return_status == False:
self.assertTrue(False)


def tearDown(self):
rmtree(self.cards_source_dir)
rmtree(self.cgc.tmp_dest_dir)
Expand Down

0 comments on commit ff8ab96

Please sign in to comment.