Permalink
Browse files

Fix some tests

  • Loading branch information...
1 parent 025af8a commit 8621f85a075a90f06674597401b0b730b81af064 @JeremySkinner JeremySkinner committed Jun 26, 2010
View
@@ -30,6 +30,7 @@
</MODIFIERS_ORDER>
<OTHER_BRACES>END_OF_LINE</OTHER_BRACES>
<TYPE_DECLARATION_BRACES>END_OF_LINE</TYPE_DECLARATION_BRACES>
+ <WRAP_LINES>False</WRAP_LINES>
</FormatSettings>
<UsingsSettings>
<AddImportsToDeepestScope>True</AddImportsToDeepestScope>
@@ -31,15 +31,13 @@ public class InfoRefsControllerTests {
[SetUp]
public void Setup() {
var dir = new DirectoryInfo("../../Repositories");
- controller =
- new InfoRefsController(
- new RepositoryService(new AppSettings {ReceivePack = true, UploadPack = true, RepositoriesDirectory = dir})).
+ controller = new InfoRefsController(new RepositoryService(new AppSettings {ReceivePack = true, UploadPack = true, RepositoriesDirectory = dir})).
FakeContxt();
}
[Test]
public void Gets_upload_pack_advertisement() {
- /*controller.Execute("test", "git-upload-pack");
+ controller.Execute("test", "git-upload-pack");
controller.Response.StatusCode.ShouldEqual(200);
controller.Response.ContentType.ShouldContain("application/x-git-upload-pack-advertisement");
@@ -49,7 +47,6 @@ public class InfoRefsControllerTests {
body.ShouldContain("0000009514bf0836c3371b740ebad55fbda6223bd7940f20 HEAD");
body.ShouldContain("multi_ack_detailed");
-*/
}
[Test]
@@ -75,7 +75,7 @@ public class HttpResponseMock : Mock<HttpResponseBase> {
Setup(x => x.OutputStream).Returns(outputStream);
SetupProperty(x => x.ContentType);
SetupProperty(x => x.StatusCode);
- Setup(x => x.Write(It.IsAny<string>())).Callback(new Action<string>(s => { writer.Write(s); }));
+ Setup(x => x.Write(It.IsAny<string>())).Callback(new Action<string>(s => { writer.Write(s); writer.Flush(); }));
}
}
@@ -37,6 +37,9 @@ public static class TestExtensions {
}
public static string GetString(this Stream stream) {
+ if(stream.CanSeek) {
+ stream.Position = 0;
+ }
var reader = new StreamReader(stream, Encoding.UTF8);
var read = new char[256];
int count = reader.Read(read, 0, 256);
@@ -51,7 +51,7 @@ public class RpcController : BaseController {
}
ActionResult ExecuteRpc(string project, Rpc rpc, Action<Repository> action) {
- if (!HasAccess(Rpc.UploadPack, checkContentType: true)) {
+ if (!HasAccess(rpc, checkContentType: true)) {
return new ForbiddenResult();
}

0 comments on commit 8621f85

Please sign in to comment.