Unit test fixes

pull/571/head
Piero Toffanin 2018-12-10 11:45:17 -05:00
rodzic 93c28a8ab9
commit c65575f589
4 zmienionych plików z 7 dodań i 5 usunięć

Wyświetl plik

@ -688,8 +688,7 @@ class Task(models.Model):
nonlocal total_images
resized_images_count += 1
if time.time() - last_update >= 2 or resized_images_count == total_images:
logger.info(self.id)
if time.time() - last_update >= 2:
Task.objects.filter(pk=self.id).update(resize_progress=(float(resized_images_count) / float(total_images)))
last_update = time.time()
@ -698,6 +697,8 @@ class Task(models.Model):
partial(resize_image, resize_to=self.resize_to, done=callback),
images_path)))
Task.objects.filter(pk=self.id).update(resize_progress=1.0)
return resized_images
def resize_gcp(self, resized_images):

Wyświetl plik

@ -163,6 +163,7 @@ class TestApiTask(BootTransactionTestCase):
self.assertTrue(float(py) == 8.0) # Didn't change
# Resize progress is 100%
resized_task.refresh_from_db()
self.assertEqual(resized_task.resize_progress, 1.0)
# Upload progress is 100%

@ -1 +1 @@
Subproject commit bcbec55c039b02c068da18da466f268d1baa1fce
Subproject commit d0e1e1424e90c21fee401ce6e5a7dd1de7b32112

Wyświetl plik

@ -45,7 +45,7 @@ class TestClientApi(TestCase):
info = self.api_client.info()
self.assertTrue(isinstance(info['version'], six.string_types), "Found version string")
self.assertTrue(isinstance(info['taskQueueCount'], int), "Found task queue count")
self.assertTrue(isinstance(info['maxImages'], int), "Found task max images")
self.assertTrue(info['maxImages'] is None, "Found task max images")
def test_options(self):
options = self.api_client.options()
@ -62,7 +62,7 @@ class TestClientApi(TestCase):
self.assertTrue(online_node.last_refreshed is not None, "Last refreshed is set")
self.assertTrue(len(online_node.available_options) > 0, "Available options are set")
self.assertTrue(online_node.api_version != "", "API version is set")
self.assertTrue(online_node.max_images > 0, "Max images is set")
self.assertTrue(online_node.max_images is None, "No max images limit is set")
self.assertTrue(isinstance(online_node.get_available_options_json(), six.string_types), "Available options json works")
self.assertTrue(isinstance(online_node.get_available_options_json(pretty=True), six.string_types), "Available options json works with pretty")