<commit_before>package org.broadinstitute.dsde.snoop

import org.broadinstitute.dsde.snoop.dataaccess.SnoopSubmissionController
import org.broadinstitute.dsde.snoop.ws.WorkflowParameter.WorkflowParameter
import org.broadinstitute.dsde.snoop.ws._
import org.scalatest.FlatSpec
import org.scalatest.Matchers
import spray.httpx.SprayJsonSupport
import spray.http._
import StatusCodes._
import WorkflowExecutionJsonSupport._
import SprayJsonSupport._
import org.scalatest.FlatSpec
import org.scalatest.Matchers
import spray.testkit.ScalatestRouteTest
import scala.concurrent.Future
import spray.routing.RequestContext

class SnoopApiServiceSpec extends FlatSpec with RootSnoopApiService with WorkflowExecutionApiService with ScalatestRouteTest with Matchers with TestDatabase {
  def actorRefFactory = system

  def executionServiceConstructor(): WorkflowExecutionService = ZamboniWorkflowExecutionService(MockZamboniApi, "test", new SnoopSubmissionController(() => TestDatabase.db, DatabaseConfig.slickDriver))

  "Snoop" should "return a greeting for GET requests to the root path" in {
    Get() ~> baseRoute ~> check {
      responseAs[String] should include("Snoop web service is operational")
    }
  }

  it should "return 201 for post to workflowExecution" in {
    Post("/workflowExecutions", HttpEntity(ContentTypes.`application/json`, s"""{
          "workflowParameters": {"para1": "v1", "p2": "v2"},
          "workflowId":  "workflow_id",
          "callbackUri": "callback"}""")) ~>
      addHeader(HttpHeaders.`Cookie`(HttpCookie("iPlanetDirectoryPro", "test_token"))) ~>
      sealRoute(startWorkflowRoute) ~>
      check {
      status === Created<commit_msg>extend timeout<commit_after>package org.broadinstitute.dsde.snoop

import org.broadinstitute.dsde.snoop.dataaccess.SnoopSubmissionController
import org.broadinstitute.dsde.snoop.ws.WorkflowParameter.WorkflowParameter
import org.broadinstitute.dsde.snoop.ws._
import org.scalatest.FlatSpec
import org.scalatest.Matchers
import spray.httpx.SprayJsonSupport
import spray.http._
import StatusCodes._
import WorkflowExecutionJsonSupport._
import SprayJsonSupport._
import org.scalatest.FlatSpec
import org.scalatest.Matchers
import spray.testkit.ScalatestRouteTest
import scala.concurrent.duration._

class SnoopApiServiceSpec extends FlatSpec with RootSnoopApiService with WorkflowExecutionApiService with ScalatestRouteTest with Matchers with TestDatabase {
  def actorRefFactory = system

  def executionServiceConstructor(): WorkflowExecutionService = ZamboniWorkflowExecutionService(MockZamboniApi, "test", new SnoopSubmissionController(() => TestDatabase.db, DatabaseConfig.slickDriver))

  implicit val routeTestTimeout = RouteTestTimeout(5 second)

  "Snoop" should "return a greeting for GET requests to the root path" in {
    Get() ~> baseRoute ~> check {
      responseAs[String] should include("Snoop web service is operational")
    }
  }

  it should "return 201 for post to workflowExecution" in {
    Post("/workflowExecutions", HttpEntity(ContentTypes.`application/json`, s"""{
          "workflowParameters": {"para1": "v1", "p2": "v2"},
          "workflowId":  "workflow_id",
          "callbackUri": "callback"}""")) ~>
      addHeader(HttpHeaders.`Cookie`(HttpCookie("iPlanetDirectoryPro", "test_token"))) ~>
      sealRoute(startWorkflowRoute) ~>
      check {
      status === Created
{'fraction_non_alphanumeric': 0.09653538643766657, 'fraction_numerical': 0.004441812259401836, 'mean_word_length': 5.471264367816092, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '419700', 'n_tokens_mistral': 1003, 'n_tokens_neox': 967, 'n_words': 219}