Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions test/Twilio.Test/ClusterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Twilio.Rest.Events.V1;
using Twilio.Rest.PreviewIam;
using System.Linq;
using Twilio.Credential;
namespace Twilio.Tests
{
[TestFixture]
Expand All @@ -21,6 +22,10 @@ class ClusterTest
string orgsSid;
string clientId;
string clientSecret;
string oAuthClientId;
string oAuthClientSecret;
string oAuthMessageId;

[SetUp]
[Category("ClusterTest")]
public void SetUp()
Expand All @@ -33,6 +38,10 @@ public void SetUp()
orgsSid = Environment.GetEnvironmentVariable("TWILIO_ORG_SID");
clientId = Environment.GetEnvironmentVariable("TWILIO_ORGS_CLIENT_ID");
clientSecret = Environment.GetEnvironmentVariable("TWILIO_ORGS_CLIENT_SECRET");

oAuthClientId = Environment.GetEnvironmentVariable("TWILIO_CLIENT_ID");
oAuthClientSecret = Environment.GetEnvironmentVariable("TWILIO_CLIENT_SECRET");
oAuthMessageId = Environment.GetEnvironmentVariable("TWILIO_MESSAGE_SID");
TwilioClient.Init(username:apiKey,password:secret,accountSid:accountSid);
TwilioOrgsTokenAuthClient.Init(clientId, clientSecret);
}
Expand Down Expand Up @@ -143,5 +152,22 @@ public void TestFetchingOrgsAccounts()
Assert.IsNotNull(userList);

}

[Test]
[Category("ClusterTest")]
public void TestPublicOAuth()
{

CredentialProvider cp = new ClientCredentialProvider(oAuthClientId,oAuthClientSecret);
TwilioClient.SetAccountSid(accountSid);
TwilioClient.Init(cp, accountSid);

// Fetching an existing message; if this test fails, the SID might be deleted,
// in that case, change TWILIO_MESSAGE_SID in twilio-csharp repo env variables
FetchMessageOptions fm = new FetchMessageOptions(oAuthMessageId);
MessageResource m = MessageResource.Fetch(fm);
Assert.IsNotNull(m.Body);

}
}
}