-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathTokenRefreshTest.cs
35 lines (31 loc) · 1.06 KB
/
TokenRefreshTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using Xunit;
namespace RingCentral.Tests;
[Collection("Sequential")]
public class TokenRefreshTest
{
[Fact]
public async void RefreshToken()
{
var rc = new RestClient(
Environment.GetEnvironmentVariable("RINGCENTRAL_CLIENT_ID"),
Environment.GetEnvironmentVariable("RINGCENTRAL_CLIENT_SECRET"),
Environment.GetEnvironmentVariable("RINGCENTRAL_SERVER_URL")
);
await rc.Authorize(
Environment.GetEnvironmentVariable("RINGCENTRAL_JWT_TOKEN")
);
var refreshToken = rc.token.refresh_token;
await rc.Refresh();
Assert.NotNull(rc.token);
Assert.NotNull(rc.token.refresh_token);
Assert.NotEqual(refreshToken, rc.token.refresh_token);
rc.token.refresh_token = refreshToken;
Assert.Equal(refreshToken, rc.token.refresh_token);
await rc.Refresh();
Assert.NotNull(rc.token);
Assert.NotNull(rc.token.refresh_token);
Assert.NotEqual(refreshToken, rc.token.refresh_token);
await rc.Revoke();
}
}