Skip to content

Commit

Permalink
fix: use lower case version of role when creating token (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tr00d authored Jan 12, 2024
1 parent f3de99a commit a47c99c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion OpenTok/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private string BuildDataString(Role role, double expireTime, string connectionDa
dataStringBuilder.Append(string.Format("session_id={0}", this.Id));
dataStringBuilder.Append(string.Format("&create_time={0}", (long)createTime));
dataStringBuilder.Append(string.Format("&nonce={0}", nonce));
dataStringBuilder.Append(string.Format("&role={0}", role.ToString()));
dataStringBuilder.Append(string.Format("&role={0}", role.ToString().ToLowerInvariant()));

if (initialLayoutClassList != null)
{
Expand Down
10 changes: 5 additions & 5 deletions OpenTokTest/TokenTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void GenerateTokenTest()
Assert.NotNull(data["sig"]);
Assert.NotNull(data["create_time"]);
Assert.NotNull(data["nonce"]);
Assert.Equal(data["role"], Role.PUBLISHER.ToString());
Assert.Equal(data["role"], "publisher");

Check warning on line 27 in OpenTokTest/TokenTests.cs

View workflow job for this annotation

GitHub Actions / build

The literal or constant value "publisher" should be passed as the 'expected' argument in the call to 'Assert.Equal(expected, actual)' in method 'GenerateTokenTest' on type 'TokenTests'. Swap the parameter values.
}

[Fact]
Expand All @@ -42,7 +42,7 @@ public void GenerateTokenWithRoleTest()
Assert.NotNull(data["sig"]);
Assert.NotNull(data["create_time"]);
Assert.NotNull(data["nonce"]);
Assert.Equal(data["role"], Role.SUBSCRIBER.ToString());
Assert.Equal(data["role"], "subscriber");

Check warning on line 45 in OpenTokTest/TokenTests.cs

View workflow job for this annotation

GitHub Actions / build

The literal or constant value "subscriber" should be passed as the 'expected' argument in the call to 'Assert.Equal(expected, actual)' in method 'GenerateTokenWithRoleTest' on type 'TokenTests'. Swap the parameter values.
}

[Fact]
Expand All @@ -61,7 +61,7 @@ public void GenerateTokenWithExpireTimeTest()
Assert.NotNull(data["sig"]);
Assert.NotNull(data["create_time"]);
Assert.NotNull(data["nonce"]);
Assert.Equal(data["role"], Role.PUBLISHER.ToString());
Assert.Equal(data["role"], "publisher");

Check warning on line 64 in OpenTokTest/TokenTests.cs

View workflow job for this annotation

GitHub Actions / build

The literal or constant value "publisher" should be passed as the 'expected' argument in the call to 'Assert.Equal(expected, actual)' in method 'GenerateTokenWithExpireTimeTest' on type 'TokenTests'. Swap the parameter values.
Assert.Equal(data["expire_time"], ((long) expireTime).ToString());
}

Expand All @@ -80,7 +80,7 @@ public void GenerateTokenWithConnectionDataTest()
Assert.NotNull(data["sig"]);
Assert.NotNull(data["create_time"]);
Assert.NotNull(data["nonce"]);
Assert.Equal(data["role"], Role.PUBLISHER.ToString());
Assert.Equal(data["role"], "publisher");

Check warning on line 83 in OpenTokTest/TokenTests.cs

View workflow job for this annotation

GitHub Actions / build

The literal or constant value "publisher" should be passed as the 'expected' argument in the call to 'Assert.Equal(expected, actual)' in method 'GenerateTokenWithConnectionDataTest' on type 'TokenTests'. Swap the parameter values.
Assert.Equal(data["connection_data"], connectionData);
}

Expand All @@ -101,7 +101,7 @@ public void GenerateTokenWithInitialLayoutClass()
Assert.NotNull(data["sig"]);
Assert.NotNull(data["create_time"]);
Assert.NotNull(data["nonce"]);
Assert.Equal(data["role"], Role.PUBLISHER.ToString());
Assert.Equal(data["role"],"publisher");

Check warning on line 104 in OpenTokTest/TokenTests.cs

View workflow job for this annotation

GitHub Actions / build

The literal or constant value "publisher" should be passed as the 'expected' argument in the call to 'Assert.Equal(expected, actual)' in method 'GenerateTokenWithInitialLayoutClass' on type 'TokenTests'. Swap the parameter values.
Assert.Equal("focus", data["initial_layout_class_list"]);
}

Expand Down

0 comments on commit a47c99c

Please sign in to comment.