public void TestSignerWithBasicCredentials() { var pipeline = new RuntimePipeline(new MockHandler()); pipeline.AddHandler(new Signer()); pipeline.AddHandler(new CredentialsRetriever(new BasicAWSCredentials("accessKey", "secretKey"))); var context = CreateTestContext(); var signer = new MockSigner(); ((RequestContext)context.RequestContext).Signer = signer; pipeline.InvokeSync(context); Assert.IsTrue(context.RequestContext.IsSigned); Assert.AreEqual(1, signer.SignCount); }
public async Task TestSignerWithBasicCredentialsAsync() { var pipeline = new RuntimePipeline(new MockHandler()); pipeline.AddHandler(new Signer()); pipeline.AddHandler(new CredentialsRetriever(new BasicAWSCredentials("accessKey", "secretKey"))); var context = CreateTestContext(); var signer = new MockSigner(); ((RequestContext)context.RequestContext).Signer = signer; await pipeline.InvokeAsync<AmazonWebServiceResponse>(context); Assert.IsTrue(context.RequestContext.IsSigned); Assert.AreEqual(1, signer.SignCount); }
public void TestSignerWithAnonymousCredentials() { var pipeline = new RuntimePipeline(new MockHandler()); pipeline.AddHandler(new Signer()); pipeline.AddHandler(new CredentialsRetriever(new AnonymousAWSCredentials())); var context = CreateTestContext(); var signer = new MockSigner(); ((RequestContext)context.RequestContext).Signer = signer; pipeline.InvokeSync(context); Assert.IsTrue(context.RequestContext.IsSigned); Assert.AreEqual(0, signer.SignCount); }