Skip to content

Commit

Permalink
add shared gallery tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kangsun-ctrl committed Feb 8, 2021
1 parent e50747f commit 70ad6ef
Show file tree
Hide file tree
Showing 5 changed files with 1,328 additions and 525 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public class SharedGalleryTests : VMTestBase
{
// these needs to be decided and created, especially subscription.
// two gallery shared to the tenant, but only one gallery shared to the sub
protected const string GalleryUniqueName = "97f78232-382b-46a7-8a72-964d692c4f3f-LONGLIVEGALLERYCXYCGPPV";
protected const string GalleryUniqueName = "97f78232-382b-46a7-8a72-964d692c4f3f-LONGLIVEGALLERYFOJNVV";
protected const string GalleryImageName = "jmaesscc";
protected const string GalleryImageVersionName = "1.0.0";

private string galleryAccessLocation = "eastus2";
private string galleryAccessLocation = "eastus2euap";

[Fact]
public void SharedGallery_GetAndList_Tests()
Expand All @@ -41,7 +41,7 @@ public void SharedGallery_GetAndList_Tests()
Trace.TraceInformation("Got the shared galleries which are shared to tenant of current subscription.");

int count = sharedGalleriesList.Count();
Assert.Equal(2, count);
Assert.Equal(1, count);

foreach(SharedGallery gallery in sharedGalleriesList)
{
Expand All @@ -60,6 +60,14 @@ public void SharedGallery_GetAndList_Tests()

ValidateSharedGallery(sharedGalleriesList.First());

sharedGalleriesList = m_CrpClient.SharedGalleries.List(galleryAccessLocation, sharedTo: SharedToValues.Tenant);

count = sharedGalleriesList.Count();
Assert.Equal(1, count);
Trace.TraceInformation("Got the shared gallery {0} which is shared to current tenant.", GalleryUniqueName);

ValidateSharedGallery(sharedGalleriesList.First());

}
}

Expand All @@ -73,6 +81,7 @@ public void SharedGalleryImage_GetAndList_Tests()
SharedGalleryImage sharedGalleryImageOut = m_CrpClient.SharedGalleryImages.Get(galleryAccessLocation, GalleryUniqueName, GalleryImageName);
Trace.TraceInformation("Got the shared gallery image {0} which is shared to current subscription.", GalleryImageName);
Assert.NotNull(sharedGalleryImageOut);

ValidateSharedGalleryImage(sharedGalleryImageOut);


Expand All @@ -98,6 +107,14 @@ public void SharedGalleryImage_GetAndList_Tests()
Trace.TraceInformation("Got the shared gallery {0} which is shared to current subscription.", GalleryUniqueName);

ValidateSharedGalleryImage(sharedGalleryImagesList.First());

sharedGalleryImagesList = m_CrpClient.SharedGalleryImages.List(galleryAccessLocation, GalleryUniqueName, sharedTo: SharedToValues.Tenant);

count = sharedGalleryImagesList.Count();
Assert.Equal(1, count);
Trace.TraceInformation("Got the shared gallery {0} which is shared to current tenant.", GalleryUniqueName);

ValidateSharedGalleryImage(sharedGalleryImagesList.First());
}
}

Expand All @@ -117,7 +134,7 @@ public void SharedGalleryImageVersion_GetAndList_Tests()
Trace.TraceInformation("Got the shared gallery image versions which are shared to tenant of current subscription.");

int count = sharedGalleryImageVersionsList.Count();
Assert.Equal(2, count);
Assert.Equal(1, count);

foreach (SharedGalleryImageVersion galleryImageVersion in sharedGalleryImageVersionsList)
{
Expand All @@ -135,6 +152,15 @@ public void SharedGalleryImageVersion_GetAndList_Tests()
Trace.TraceInformation("Got the shared gallery {0} which is shared to current subscription.", GalleryUniqueName);

ValidateSharedGalleryImageVersion(sharedGalleryImageVersionsList.First());

sharedGalleryImageVersionsList = m_CrpClient.SharedGalleryImageVersions.List(galleryAccessLocation, GalleryUniqueName, GalleryImageName,
sharedTo: SharedToValues.Tenant);

count = sharedGalleryImageVersionsList.Count();
Assert.Equal(1, count);
Trace.TraceInformation("Got the shared gallery {0} which is shared to current tenant.", GalleryUniqueName);

ValidateSharedGalleryImageVersion(sharedGalleryImageVersionsList.First());
}
}

Expand Down
Loading

0 comments on commit 70ad6ef

Please sign in to comment.