1 /*
2  *  Make.org Core API
3  *  Copyright (C) 2018 Make.org
4  *
5  * This program is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU Affero General Public License as
7  *  published by the Free Software Foundation, either version 3 of the
8  *  License, or (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU Affero General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Affero General Public License
16  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
17  *
18  */
19 
20 package org.make.api
21 
22 import cats.data.NonEmptyList
23 import eu.timepit.refined.auto._
24 import grizzled.slf4j.Logging
25 import org.make.core.BaseUnitTest
26 import org.make.core.operation.OperationKind.SecuredConsultation
27 import org.make.core.operation.{
28   OidcConfiguration,
29   Operation,
30   OperationAuthentication,
31   OperationId,
32   OperationOfQuestion,
33   ResultsLink
34 }
35 import org.make.core.question.{Question, QuestionId}
36 import org.make.core.reference.{Country, Language}
37 import org.make.core.technical.Multilingual
38 
39 import java.time.{Instant, ZonedDateTime}
40 
41 trait MakeUnitTest extends BaseUnitTest with Logging with TestUtils {
42 
43   protected val iat: Long = Instant.now().toEpochMilli / 1000
44   protected val exp: Long = iat + 3600
45   protected val oidcConfiguration: OidcConfiguration = OidcConfiguration("", "", None, "", "", None)
46   protected val oidcSecuredOperation: Operation = Operation(
47     operationId = OperationId("oidc-secured-operation"),
48     slug = "oidc-secured-operation",
49     events = Nil,
50     questions = Nil,
51     operationKind = SecuredConsultation,
52     operationAuthentication = Some(OperationAuthentication(oidc = Some(oidcConfiguration))),
53     createdAt = None,
54     updatedAt = None
55   )
56   protected val oidcSecuredQuestion: Question = Question(
57     questionId = QuestionId("oidc-secured-question"),
58     slug = "oidc-secured-question",
59     countries = NonEmptyList.of(Country("FR")),
60     defaultLanguage = Language("fr"),
61     languages = NonEmptyList.of(Language("fr")),
62     questions = Multilingual.fromDefault("secured-question"),
63     shortTitles = None,
64     operationId = Some(oidcSecuredOperation.operationId)
65   )
66   protected val oidcSecuredOperationOfQuestion: OperationOfQuestion =
67     operationOfQuestion(
68       oidcSecuredQuestion.questionId,
69       oidcSecuredOperation.operationId,
70       startDate = ZonedDateTime.parse("2018-10-21T10:15:30+00:00"),
71       endDate = ZonedDateTime.parse("2068-10-21T10:15:30+00:00"),
72       resultsLink = Some(ResultsLink.Internal.Results)
73     )
74 }
Line Stmt Id Pos Tree Symbol Tests Code
43 51648 1398 - 1431 Apply scala.Long./ org.make.api.makeunittest java.time.Instant.now().toEpochMilli()./(1000)
44 51557 1460 - 1470 Apply scala.Long.+ org.make.api.makeunittest MakeUnitTest.this.iat.+(3600)
45 51528 1566 - 1570 Select scala.None org.make.api.makeunittest scala.None
45 51800 1558 - 1560 Literal <nosymbol> org.make.api.makeunittest ""
45 51650 1526 - 1526 Select org.make.core.operation.OidcConfiguration.apply$default$8 org.make.api.makeunittest org.make.core.operation.OidcConfiguration.apply$default$8
45 51572 1526 - 1526 Select org.make.core.operation.OidcConfiguration.apply$default$9 org.make.api.makeunittest org.make.core.operation.OidcConfiguration.apply$default$9
45 51503 1552 - 1556 Select scala.None org.make.api.makeunittest scala.None
45 51847 1544 - 1546 Literal <nosymbol> org.make.api.makeunittest ""
45 51697 1562 - 1564 Literal <nosymbol> org.make.api.makeunittest ""
45 51670 1548 - 1550 Literal <nosymbol> org.make.api.makeunittest ""
45 51814 1526 - 1526 Select org.make.core.operation.OidcConfiguration.apply$default$7 org.make.api.makeunittest org.make.core.operation.OidcConfiguration.apply$default$7
45 51666 1526 - 1571 Apply org.make.core.operation.OidcConfiguration.apply org.make.api.makeunittest org.make.core.operation.OidcConfiguration.apply("", "", scala.None, "", "", scala.None, org.make.core.operation.OidcConfiguration.apply$default$7, org.make.core.operation.OidcConfiguration.apply$default$8, org.make.core.operation.OidcConfiguration.apply$default$9, org.make.core.operation.OidcConfiguration.apply$default$10)
45 51836 1526 - 1526 Select org.make.core.operation.OidcConfiguration.apply$default$10 org.make.api.makeunittest org.make.core.operation.OidcConfiguration.apply$default$10
46 51717 1622 - 1946 Apply org.make.core.operation.Operation.apply org.make.api.makeunittest org.make.core.operation.Operation.apply(org.make.core.operation.OperationId.apply("oidc-secured-operation"), "oidc-secured-operation", scala.`package`.Nil, scala.`package`.Nil, org.make.core.operation.OperationKind.SecuredConsultation, scala.Some.apply[org.make.core.operation.OperationAuthentication](org.make.core.operation.OperationAuthentication.apply(scala.Some.apply[org.make.core.operation.OidcConfiguration](MakeUnitTest.this.oidcConfiguration))), scala.None, scala.None)
47 51506 1651 - 1688 Apply org.make.core.operation.OperationId.apply org.make.api.makeunittest org.make.core.operation.OperationId.apply("oidc-secured-operation")
48 51802 1701 - 1725 Literal <nosymbol> org.make.api.makeunittest "oidc-secured-operation"
49 51716 1740 - 1743 Select scala.Nil org.make.api.makeunittest scala.`package`.Nil
50 51548 1761 - 1764 Select scala.Nil org.make.api.makeunittest scala.`package`.Nil
51 51806 1786 - 1805 Select org.make.core.operation.OperationKind.SecuredConsultation org.make.api.makeunittest org.make.core.operation.OperationKind.SecuredConsultation
52 51842 1842 - 1897 Apply org.make.core.operation.OperationAuthentication.apply org.make.api.makeunittest org.make.core.operation.OperationAuthentication.apply(scala.Some.apply[org.make.core.operation.OidcConfiguration](MakeUnitTest.this.oidcConfiguration))
52 51464 1873 - 1896 Apply scala.Some.apply org.make.api.makeunittest scala.Some.apply[org.make.core.operation.OidcConfiguration](MakeUnitTest.this.oidcConfiguration)
52 51655 1878 - 1895 Select org.make.api.MakeUnitTest.oidcConfiguration org.make.api.makeunittest MakeUnitTest.this.oidcConfiguration
52 51690 1837 - 1898 Apply scala.Some.apply org.make.api.makeunittest scala.Some.apply[org.make.core.operation.OperationAuthentication](org.make.core.operation.OperationAuthentication.apply(scala.Some.apply[org.make.core.operation.OidcConfiguration](MakeUnitTest.this.oidcConfiguration)))
53 51509 1916 - 1920 Select scala.None org.make.api.makeunittest scala.None
54 51792 1938 - 1942 Select scala.None org.make.api.makeunittest scala.None
56 51642 1995 - 2376 Apply org.make.core.question.Question.apply org.make.api.makeunittest org.make.core.question.Question.apply(org.make.core.question.QuestionId.apply("oidc-secured-question"), "oidc-secured-question", cats.data.NonEmptyList.of[org.make.core.reference.Country](org.make.core.reference.Country.apply("FR")), org.make.core.reference.Language.apply("fr"), cats.data.NonEmptyList.of[org.make.core.reference.Language](org.make.core.reference.Language.apply("fr")), org.make.core.technical.Multilingual.fromDefault[eu.timepit.refined.api.Refined[String,eu.timepit.refined.collection.NonEmpty]]((api.this.RefType.refinedRefType.unsafeWrap[String, eu.timepit.refined.collection.NonEmpty]("secured-question"): eu.timepit.refined.api.Refined[String,eu.timepit.refined.collection.NonEmpty])), scala.None, scala.Some.apply[org.make.core.operation.OperationId](MakeUnitTest.this.oidcSecuredOperation.operationId))
57 51537 2022 - 2057 Apply org.make.core.question.QuestionId.apply org.make.api.makeunittest org.make.core.question.QuestionId.apply("oidc-secured-question")
58 51829 2070 - 2093 Literal <nosymbol> org.make.api.makeunittest "oidc-secured-question"
59 51658 2127 - 2140 Apply org.make.core.reference.Country.apply org.make.api.makeunittest org.make.core.reference.Country.apply("FR")
59 51486 2111 - 2141 Apply cats.data.NonEmptyList.of org.make.api.makeunittest cats.data.NonEmptyList.of[org.make.core.reference.Country](org.make.core.reference.Country.apply("FR"))
60 51844 2165 - 2179 Apply org.make.core.reference.Language.apply org.make.api.makeunittest org.make.core.reference.Language.apply("fr")
61 51501 2197 - 2228 Apply cats.data.NonEmptyList.of org.make.api.makeunittest cats.data.NonEmptyList.of[org.make.core.reference.Language](org.make.core.reference.Language.apply("fr"))
61 51693 2213 - 2227 Apply org.make.core.reference.Language.apply org.make.api.makeunittest org.make.core.reference.Language.apply("fr")
62 51795 2246 - 2290 Apply org.make.core.technical.Multilingual.fromDefault org.make.api.makeunittest org.make.core.technical.Multilingual.fromDefault[eu.timepit.refined.api.Refined[String,eu.timepit.refined.collection.NonEmpty]]((api.this.RefType.refinedRefType.unsafeWrap[String, eu.timepit.refined.collection.NonEmpty]("secured-question"): eu.timepit.refined.api.Refined[String,eu.timepit.refined.collection.NonEmpty]))
63 51701 2310 - 2314 Select scala.None org.make.api.makeunittest scala.None
64 51539 2339 - 2371 Select org.make.core.operation.Operation.operationId org.make.api.makeunittest MakeUnitTest.this.oidcSecuredOperation.operationId
64 51831 2334 - 2372 Apply scala.Some.apply org.make.api.makeunittest scala.Some.apply[org.make.core.operation.OperationId](MakeUnitTest.this.oidcSecuredOperation.operationId)
67 51743 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$18 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$18
67 51779 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$12 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$12
67 51683 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$10 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$10
67 51680 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$29 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$29
67 51554 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$23 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$23
67 51626 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$22 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$22
67 51635 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$16 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$16
67 51835 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$24 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$24
67 51476 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$36 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$36
67 51826 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$34 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$34
67 51542 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$5 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$5
67 51533 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$14 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$14
67 51488 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$27 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$27
67 51661 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$35 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$35
67 51628 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$32 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$32
67 51637 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$26 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$26
67 51804 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$6 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$6
67 51840 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$9 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$9
67 51481 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$8 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$8
67 51499 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$20 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$20
67 51484 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$17 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$17
67 51807 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$15 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$15
67 51496 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$11 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$11
67 51523 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$30 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$30
67 51774 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$21 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$21
67 51768 2451 - 2744 Apply org.make.api.TestUtils.operationOfQuestion org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion(x$1, x$2, x$3, x$4, x$6, x$7, x$8, x$9, x$10, x$11, x$12, x$13, x$14, x$15, x$16, x$17, x$18, x$19, x$20, x$21, x$22, x$23, x$24, x$25, x$5, x$26, x$27, x$28, x$29, x$30, x$31, x$32, x$33, x$34, x$35, x$36)
67 51624 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$13 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$13
67 51696 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$19 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$19
67 51645 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$7 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$7
67 51531 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$33 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$33
67 51785 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$31 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$31
67 51767 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$28 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$28
68 51487 2478 - 2508 Select org.make.core.question.Question.questionId org.make.api.makeunittest MakeUnitTest.this.oidcSecuredQuestion.questionId
69 51839 2516 - 2548 Select org.make.core.operation.Operation.operationId org.make.api.makeunittest MakeUnitTest.this.oidcSecuredOperation.operationId
70 51682 2568 - 2616 Apply java.time.ZonedDateTime.parse org.make.api.makeunittest java.time.ZonedDateTime.parse("2018-10-21T10:15:30+00:00")
71 51505 2634 - 2682 Apply java.time.ZonedDateTime.parse org.make.api.makeunittest java.time.ZonedDateTime.parse("2068-10-21T10:15:30+00:00")
72 51608 2704 - 2738 Apply scala.Some.apply org.make.api.makeunittest scala.Some.apply[org.make.core.operation.ResultsLink.Internal.Results.type](org.make.core.operation.ResultsLink.Internal.Results)
72 51777 2709 - 2737 Select org.make.core.operation.ResultsLink.Internal.Results org.make.api.makeunittest org.make.core.operation.ResultsLink.Internal.Results