Skip to content

Commit

Permalink
Merge 1bc1fce into 8f2c5f3
Browse files Browse the repository at this point in the history
  • Loading branch information
Bradley R Taylor committed May 8, 2015
2 parents 8f2c5f3 + 1bc1fce commit bc9a674
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 0 deletions.
52 changes: 52 additions & 0 deletions src/test/resources/TESTMARKDOWN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Basic Text
Here is some text that includes some "double quotes" and some 'single quotes' and some "combinations 'thereof'".
It {(also) [includes]} <some\> /extra \special \ncharacters. Think \*they'll be ~ok\?
!@#$%^&*,.?;:=/-+

# Headings
# The largest heading (an <h1> tag)
## The second largest heading (an <h2> tag)
### The third largest heading (an <h3> tag)
#### The fourth largest heading (an <h4> tag)
##### The fifth largest heading (an <h5> tag)
###### The sixth largest heading (an <h6> tag)

# Line Breaks
Below is a line break
=====

# Block-Quotes
> This is a blockquote. It "includes" some quotation marks.
# Text Styling
**This _is_ a string that combines both bolds and italics.**

# Lists
This is a nested list that combines both unordered and ordered list with multiple levels of indenture.
1. Item 1
1. A corollary to the above item.
2. Yet another point to consider.
2. Item 2
* A corollary that does not need to be ordered.
* This is indented four spaces, because it's two spaces further than the item above.
* You might want to consider making a new list.
3. Item 3

# Code Formatting
Here is some text with `monospacing`, within which text appears `**AS**IS`.

# Code Blocks
```
# Here is a block of code
x = 0
x = 2 + 2
what is x
```

# Links
Here is a regular link:
Scala](http://www.scala-lang.org/)
Here are some image links:
[![Build Status](https://travis-ci.org/broadinstitute/agora.svg?branch=master)](https://travis-ci.org/broadinstitute/agora?branch=master)
[![Coverage Status](https://coveralls.io/repos/broadinstitute/agora/badge.svg?branch=master)](https://coveralls.io/r/broadinstitute/agora?branch=master)

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.broadinstitute.dsde.agora.server

import java.io.File

import org.broadinstitute.dsde.agora.server.model.{AgoraAddRequest, AgoraEntity}

trait AgoraTestData {
Expand All @@ -11,6 +13,17 @@ trait AgoraTestData {

val documentation = "This is the documentation"

def getbigDocumentation: String = {
val readMeFile = new File("src/test/resources/", "TESTMARKDOWN.md")

// Read contents of a test markdown file into a single string.
val markdown = io.Source.fromFile("src/test/resources/TESTMARKDOWN.md").getLines() mkString "\n"
markdown * 7 // NB: File is 1.6 Kb, so 7* that is >10kb, our minimal required storage amount.
}

// NB: save io by storing output.
val bigDocumentation: String = getbigDocumentation

val owner = "bob the builder"

val payload = """task wc {
Expand Down Expand Up @@ -50,4 +63,13 @@ trait AgoraTestData {
owner = owner,
payload = badPayload
)

val testAddRequestBigDoc = new AgoraAddRequest(
namespace = namespace,
name = name,
synopsis = synopsis,
documentation = bigDocumentation,
owner = owner,
payload = payload
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ class AgoraTestSuite extends Suites(new ApiServiceSpec, new MethodsDbTest) with
override def afterAll() {
println("Stopping embedded mongo db instance.")
mongoStop(mongoProps)
println("Stopping Agora web services.")
Agora.stop()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,11 @@ class ApiServiceSpec extends FlatSpec with Matchers with Directives with Scalate
}
}

"Agora" should "store 10kb of github markdown as method documentation and return it without alteration" in {
Post(ApiUtil.Methods.withLeadingSlash, marshal(testAddRequest)) ~> methodsService.postRoute ~> check {
val response = responseAs[AgoraEntity]
response.documentation === bigDocumentation
}
}

}

0 comments on commit bc9a674

Please sign in to comment.