Skip to content

Commit f506a80

Browse files
committed
integration tests
1 parent f196f49 commit f506a80

File tree

1 file changed

+70
-8
lines changed

1 file changed

+70
-8
lines changed

Scripts/UnitTests/TestVisualRecognition.cs

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,6 @@ private void OnDeleteClassifier(bool success, string customData)
512512
private void OnCheckClassifierStatus(GetClassifiersPerClassifierVerbose classifier, string customData)
513513
{
514514
Log.Debug("TestVisualRecognition", "classifier {0} is {1}!", classifier.classifier_id, classifier.status);
515-
516515
if (classifier.status == "unavailable" || classifier.status == "failed")
517516
{
518517
Log.Debug("TestVisualRecognition", "Deleting classifier!");
@@ -565,38 +564,101 @@ private void OnDeleteClassifierFinal(GetClassifiersPerClassifierVerbose classifi
565564
{
566565
Log.Debug("TestVisualRecognition", "Classifier {0} found! Delete failed!", classifier.name);
567566
}
567+
Test(classifier == null);
568568
}
569569

570570
private void OnGetCollections(GetCollections collections, string customData)
571571
{
572-
572+
if(collections != null)
573+
{
574+
Log.Debug("TestVisualRecognition", "Get Collections succeeded!");
575+
foreach (CreateCollection collection in collections.collections)
576+
{
577+
Log.Debug("TestVisualRecognition", "collectionID: {0} | collection name: {1} | number of images: {2}", collection.collection_id, collection.name, collection.images);
578+
}
579+
}
580+
else
581+
{
582+
Log.Debug("TestVisualRecognition", "Get Collections failed!");
583+
}
584+
585+
Test(collections != null);
573586
}
574587

575588
private void OnCreateCollection(CreateCollection collection, string customData)
576589
{
577-
m_CreatedCollectionID = collection.collection_id;
578-
590+
if(collection != null)
591+
{
592+
Log.Debug("TestVisualRecognition", "Create Collection succeeded!");
593+
Log.Debug("TestVisualRecognition", "collectionID: {0} | collection name: {1} | collection images: {2}", collection.collection_id, collection.name, collection.images);
594+
595+
m_CreatedCollectionID = collection.collection_id;
596+
}
597+
else
598+
{
599+
Log.Debug("TestVisualRecognition", "Create Collection failed!");
600+
}
601+
602+
Test(collection != null);
579603
}
580604

581605
private void OnDeleteCollection(bool success, string customData)
582606
{
607+
if(success)
608+
Log.Debug("TestVisualRecognition", "Delete Collection succeeded!");
609+
else
610+
Log.Debug("TestVisualRecognition", "Delete Collection failed!");
583611

612+
Test(success);
584613
}
585614

586615
private void OnGetCollection(CreateCollection collection, string customData)
587616
{
588-
617+
if (collection != null)
618+
{
619+
Log.Debug("TestVisualRecognition", "Get Collection succeded!");
620+
Log.Debug("TestVisualRecognition", "collectionID: {0} | collection name: {1} | collection images: {2}", collection.collection_id, collection.name, collection.images);
621+
}
622+
else
623+
{
624+
Log.Debug("TestVisualRecognition", "Get Collection failed!");
625+
626+
}
627+
628+
Test(collection != null);
589629
}
590630

591631
private void OnGetCollections(GetCollectionImages collections, string customData)
592632
{
593-
633+
if(collections != null)
634+
{
635+
Log.Debug("TestVisualRecognition", "Get Collections succeded!");
636+
foreach(GetCollectionsBrief collection in collections.images)
637+
Log.Debug("TestVisualRecognition", "imageID: {0} | image file: {1} | image metadataOnGetCollections: {2}", collection.image_id, collection.image_file, collection.metadata.ToString());
638+
}
639+
else
640+
{
641+
Log.Debug("TestVisualRecognition", "Get Collections failed!");
642+
}
643+
644+
Test(collections != null);
594645
}
595646

596647
private void OnAddImageToCollection(CollectionsConfig images, string customData)
597648
{
598-
m_CreatedCollectionImage = images.images[0].image_id;
599-
}
649+
if(images != null)
650+
{
651+
Log.Debug("TestVisualRecognition", "Add image to collection succeeded!");
652+
m_CreatedCollectionImage = images.images[0].image_id;
653+
Log.Debug("TestVisualRecognition", "images processed: {0}", images.images_processed);
654+
foreach (CollectionImagesConfig image in images.images)
655+
Log.Debug("TestVisualRecognition", "imageID: {0} | image_file: {1} | image metadata: {1}", image.image_id, image.image_file, image.metadata.ToString());
656+
}
657+
else
658+
{
659+
Log.Debug("TestVisualRecognition", "Add image to collection failed!");
660+
}
661+
}
600662

601663
private void OnDeleteCollectionImage(bool success, string customData)
602664
{

0 commit comments

Comments
 (0)