Skip to content

Commit 6713c19

Browse files
committed
add back run as tests now that we send the right header in the beta1 world
1 parent 4f0ffa3 commit 6713c19

File tree

4 files changed

+64
-64
lines changed

4 files changed

+64
-64
lines changed

src/Elasticsearch.Net/Connection/HttpConnection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ protected virtual HttpWebRequest CreateWebRequest(RequestData requestData)
5151
request.Headers.Add("Content-Encoding", "gzip");
5252
}
5353
if (!requestData.RunAs.IsNullOrEmpty())
54-
request.Headers.Add("es-shield-runas-user", requestData.RunAs);
54+
request.Headers.Add("es-security-runas-user", requestData.RunAs);
5555

5656
if (requestData.Headers != null && requestData.Headers.HasKeys())
5757
request.Headers.Add(requestData.Headers);

src/Tests/XPack/Security/Role/PutRole/PutRoleApiTests.cs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -94,34 +94,34 @@ protected override void ExpectResponse(IPutRoleResponse response)
9494
}
9595

9696
//TODO this might be a bug in xpack but more likely a misunderstanding on our part ignore for now
97-
//public class PutRoleRunAsApiTests : PutRoleApiTests
98-
//{
99-
// public PutRoleRunAsApiTests(XPackCluster cluster, EndpointUsage usage) : base(cluster, usage) { }
100-
101-
// protected override bool ExpectIsValid => false;
102-
// protected override int ExpectStatusCode => 401;
103-
104-
// protected override PutRoleRequest Initializer
105-
// {
106-
// get
107-
// {
108-
// var request = base.Initializer;
109-
// request.RequestConfiguration = new RequestConfiguration
110-
// {
111-
// RunAs = ShieldInformation.User.Username
112-
// };
113-
// return request;
114-
// }
115-
// }
116-
117-
// protected override Func<PutRoleDescriptor, IPutRoleRequest> Fluent => f => base.Fluent(f
118-
// .RequestConfiguration(c => c
119-
// .RunAs(ShieldInformation.User.Username)
120-
// ));
121-
122-
// protected override void ExpectResponse(IPutRoleResponse response)
123-
// {
124-
// }
125-
//}
97+
public class PutRoleRunAsApiTests : PutRoleApiTests
98+
{
99+
public PutRoleRunAsApiTests(XPackCluster cluster, EndpointUsage usage) : base(cluster, usage) { }
100+
101+
protected override bool ExpectIsValid => false;
102+
protected override int ExpectStatusCode => 403;
103+
104+
protected override PutRoleRequest Initializer
105+
{
106+
get
107+
{
108+
var request = base.Initializer;
109+
request.RequestConfiguration = new RequestConfiguration
110+
{
111+
RunAs = ShieldInformation.User.Username
112+
};
113+
return request;
114+
}
115+
}
116+
117+
protected override Func<PutRoleDescriptor, IPutRoleRequest> Fluent => f => base.Fluent(f
118+
.RequestConfiguration(c => c
119+
.RunAs(ShieldInformation.User.Username)
120+
));
121+
122+
protected override void ExpectResponse(IPutRoleResponse response)
123+
{
124+
}
125+
}
126126

127127
}

src/Tests/XPack/Security/User/PutUser/PutUserApiTests.cs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -76,38 +76,38 @@ protected override void ExpectResponse(IPutUserResponse response)
7676
}
7777

7878
//TODO disabled for now pending bug report
79-
//public class PutUserRunAsApiTests : PutUserApiTests
80-
//{
81-
// public PutUserRunAsApiTests(XPackCluster cluster, EndpointUsage usage) : base(cluster, usage)
82-
// {
83-
// var x = this.Client.GetUser(new GetUserRequest(ShieldInformation.User.Username));
84-
// var y = this.Client.GetRole(new GetRoleRequest(ShieldInformation.User.Role));
85-
// }
86-
87-
// protected override bool ExpectIsValid => false;
88-
// protected override int ExpectStatusCode => 403;
89-
90-
// protected override PutUserRequest Initializer
91-
// {
92-
// get
93-
// {
94-
// var request = base.Initializer;
95-
// request.RequestConfiguration = new RequestConfiguration
96-
// {
97-
// RunAs = ShieldInformation.User.Username
98-
// };
99-
// return request;
100-
// }
101-
// }
102-
103-
// protected override Func<PutUserDescriptor, IPutUserRequest> Fluent => f => base.Fluent(f
104-
// .RequestConfiguration(c=>c
105-
// .RunAs(ShieldInformation.User.Username)
106-
// ));
107-
108-
// protected override void ExpectResponse(IPutUserResponse response)
109-
// {
110-
// }
111-
//}
79+
public class PutUserRunAsApiTests : PutUserApiTests
80+
{
81+
public PutUserRunAsApiTests(XPackCluster cluster, EndpointUsage usage) : base(cluster, usage)
82+
{
83+
var x = this.Client.GetUser(new GetUserRequest(ShieldInformation.User.Username));
84+
var y = this.Client.GetRole(new GetRoleRequest(ShieldInformation.User.Role));
85+
}
86+
87+
protected override bool ExpectIsValid => false;
88+
protected override int ExpectStatusCode => 403;
89+
90+
protected override PutUserRequest Initializer
91+
{
92+
get
93+
{
94+
var request = base.Initializer;
95+
request.RequestConfiguration = new RequestConfiguration
96+
{
97+
RunAs = ShieldInformation.User.Username
98+
};
99+
return request;
100+
}
101+
}
102+
103+
protected override Func<PutUserDescriptor, IPutUserRequest> Fluent => f => base.Fluent(f
104+
.RequestConfiguration(c => c
105+
.RunAs(ShieldInformation.User.Username)
106+
));
107+
108+
protected override void ExpectResponse(IPutUserResponse response)
109+
{
110+
}
111+
}
112112

113113
}

src/Tests/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# mode either u (unit test), i (integration test) or m (mixed mode)
2-
mode: u
2+
mode: i
33
# the elasticsearch version that should be started
44
# Can be a snapshot version of sonatype or "latest" to get the latest snapshot of sonatype
55
elasticsearch_version: 5.0.0-beta1

0 commit comments

Comments
 (0)