-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathCommentAuthAttrTests.cs
More file actions
61 lines (53 loc) · 1.94 KB
/
Copy pathCommentAuthAttrTests.cs
File metadata and controls
61 lines (53 loc) · 1.94 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
namespace NpgsqlRestTests;
public static partial class Database
{
public static void CommentAuthAttrTests()
{
script.Append(@"
create function comment_authorize1() returns text language sql as 'select ''authorize1''';
comment on function comment_authorize1() is 'HTTP
Authorize';
create function comment_authorize2() returns text language sql as 'select ''authorize2''';
comment on function comment_authorize2() is 'HTTP
RequiresAuthorization';
-- missing leading HTTP tag, authorize should be ignored
create function comment_authorize3() returns text language sql as 'select ''authorize3''';
comment on function comment_authorize3() is '
Authorize';
-- HTTP should precede Authorize
create function comment_authorize4() returns text language sql as 'select ''authorize4''';
comment on function comment_authorize4() is 'Authorize
HTTP';
");
}
}
[Collection("TestFixture")]
public class CommentAuthAttrTests(TestFixture test)
{
[Fact]
public async Task Test_comment_authorize1()
{
using var response1 = await test.Client.PostAsync("/api/comment-authorize1/", null);
response1?.StatusCode.Should().Be(HttpStatusCode.Unauthorized);
}
[Fact]
public async Task Test_comment_authorize2()
{
using var response1 = await test.Client.PostAsync("/api/comment-authorize2/", null);
response1?.StatusCode.Should().Be(HttpStatusCode.Unauthorized);
}
[Fact]
public async Task Test_comment_authorize3()
{
using var response1 = await test.Client.PostAsync("/api/comment-authorize3/", null);
//missing leading HTTP tag, authorize should be ignored
response1?.StatusCode.Should().Be(HttpStatusCode.OK);
}
[Fact]
public async Task Test_comment_authorize4()
{
using var response1 = await test.Client.PostAsync("/api/comment-authorize4/", null);
//HTTP should precede Authorize
response1?.StatusCode.Should().Be(HttpStatusCode.OK);
}
}