Skip to content

Commit 5800dc1

Browse files
authored
Fix Tables access policies test and configure related methods (#12567)
* fixed accesspolicies test but still errors with recordedmode * test to default, api export, and sessions Co-authored-by: Allison Kim <t-allkim@microsoft.com>
1 parent 0c3b870 commit 5800dc1

File tree

5 files changed

+312
-9
lines changed

5 files changed

+312
-9
lines changed

sdk/tables/Azure.Data.Tables/api/Azure.Data.Tables.netstandard2.0.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ protected TableClient() { }
77
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Data.Tables.Models.TableItem>> CreateAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
88
public virtual Azure.Response Delete(string partitionKey, string rowKey, string eTag = "*", System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
99
public virtual System.Threading.Tasks.Task<Azure.Response> DeleteAsync(string partitionKey, string rowKey, string eTag = "*", System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
10-
public virtual Azure.Response<System.Collections.ObjectModel.ReadOnlyCollection<Azure.Data.Tables.Models.SignedIdentifier>> GetAccessPolicy(int? timeout = default(int?), string requestId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
11-
public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.ObjectModel.ReadOnlyCollection<Azure.Data.Tables.Models.SignedIdentifier>>> GetAccessPolicyAsync(int? timeout = default(int?), string requestId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
10+
public virtual Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Data.Tables.Models.SignedIdentifier>> GetAccessPolicy(int? timeout = default(int?), string requestId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
11+
public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Data.Tables.Models.SignedIdentifier>>> GetAccessPolicyAsync(int? timeout = default(int?), string requestId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
1212
public virtual Azure.Data.Tables.Sas.TableSasBuilder GetSasBuilder(Azure.Data.Tables.Sas.TableSasPermissions permissions, System.DateTimeOffset expiresOn) { throw null; }
1313
public virtual Azure.Data.Tables.Sas.TableSasBuilder GetSasBuilder(string rawPermissions, System.DateTimeOffset expiresOn) { throw null; }
1414
public virtual Azure.Response<System.Collections.ObjectModel.ReadOnlyDictionary<string, object>> Insert(System.Collections.Generic.IDictionary<string, object> entity, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }

sdk/tables/Azure.Data.Tables/src/TableClient.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -653,21 +653,21 @@ public virtual Response Delete(string partitionKey, string rowKey, string eTag =
653653
/// <param name="requestId"> Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. </param>
654654
/// <param name="cancellationToken"> The cancellation token to use. </param>
655655
[ForwardsClientCalls]
656-
public virtual async Task<Response<ReadOnlyCollection<SignedIdentifier>>> GetAccessPolicyAsync(int? timeout = null, string requestId = null, CancellationToken cancellationToken = default)
656+
public virtual async Task<Response<IReadOnlyList<SignedIdentifier>>> GetAccessPolicyAsync(int? timeout = null, string requestId = null, CancellationToken cancellationToken = default)
657657
{
658658
var response = await _tableOperations.GetAccessPolicyAsync(_table, timeout, requestId, cancellationToken).ConfigureAwait(false);
659-
return Response.FromValue(response.Value as ReadOnlyCollection<SignedIdentifier>, response.GetRawResponse());
659+
return Response.FromValue(response.Value, response.GetRawResponse());
660660
}
661661

662662
/// <summary> Retrieves details about any stored access policies specified on the table that may be used with Shared Access Signatures. </summary>
663663
/// <param name="timeout"> The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting Timeouts for Queue Service Operations.</a>. </param>
664664
/// <param name="requestId"> Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. </param>
665665
/// <param name="cancellationToken"> The cancellation token to use. </param>
666666
[ForwardsClientCalls]
667-
public virtual Response<ReadOnlyCollection<SignedIdentifier>> GetAccessPolicy(int? timeout = null, string requestId = null, CancellationToken cancellationToken = default)
667+
public virtual Response<IReadOnlyList<SignedIdentifier>> GetAccessPolicy(int? timeout = null, string requestId = null, CancellationToken cancellationToken = default)
668668
{
669669
var response = _tableOperations.GetAccessPolicy(_table, timeout, requestId, cancellationToken);
670-
return Response.FromValue(response.Value as ReadOnlyCollection<SignedIdentifier>, response.GetRawResponse());
670+
return Response.FromValue(response.Value, response.GetRawResponse());
671671
}
672672

673673
/// <summary> sets stored access policies for the table that may be used with Shared Access Signatures. </summary>

sdk/tables/Azure.Data.Tables/tests/SessionRecords/TableClientLiveTests/GetAccessPoliciesReturnsPolicies.json

Lines changed: 150 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/tables/Azure.Data.Tables/tests/SessionRecords/TableClientLiveTests/GetAccessPoliciesReturnsPoliciesAsync.json

Lines changed: 150 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/tables/Azure.Data.Tables/tests/TableClientLiveTests.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -782,10 +782,9 @@ public async Task InsertedCustomEntitiesAreRoundtrippedProprly()
782782
/// Validates the functionality of the TableServiceClient.
783783
/// </summary>
784784
[Test]
785-
[Ignore("requires https://github.com/Azure/azure-sdk-for-net/issues/11764")]
786785
public async Task GetAccessPoliciesReturnsPolicies()
787786
{
788-
// Cratae some policies.
787+
// Create some policies.
789788

790789
var policyToCreate = new List<SignedIdentifier>
791790
{
@@ -799,7 +798,11 @@ public async Task GetAccessPoliciesReturnsPolicies()
799798

800799
var policies = await client.GetAccessPolicyAsync();
801800

802-
Assert.That(policies.Value, Is.EquivalentTo(policyToCreate));
801+
Assert.That(policies.Value[0].Id, Is.EqualTo(policyToCreate[0].Id));
802+
Assert.That(policies.Value[0].AccessPolicy.Expiry, Is.EqualTo(policyToCreate[0].AccessPolicy.Expiry));
803+
Assert.That(policies.Value[0].AccessPolicy.Permission, Is.EqualTo(policyToCreate[0].AccessPolicy.Permission));
804+
Assert.That(policies.Value[0].AccessPolicy.Start, Is.EqualTo(policyToCreate[0].AccessPolicy.Start));
805+
803806
}
804807
}
805808
}

0 commit comments

Comments
 (0)