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 51602 1398 - 1431 Apply scala.Long./ org.make.api.makeunittest java.time.Instant.now().toEpochMilli()./(1000)
44 51511 1460 - 1470 Apply scala.Long.+ org.make.api.makeunittest MakeUnitTest.this.iat.+(3600)
45 51620 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 51790 1526 - 1526 Select org.make.core.operation.OidcConfiguration.apply$default$10 org.make.api.makeunittest org.make.core.operation.OidcConfiguration.apply$default$10
45 51482 1566 - 1570 Select scala.None org.make.api.makeunittest scala.None
45 51754 1558 - 1560 Literal <nosymbol> org.make.api.makeunittest ""
45 51604 1526 - 1526 Select org.make.core.operation.OidcConfiguration.apply$default$8 org.make.api.makeunittest org.make.core.operation.OidcConfiguration.apply$default$8
45 51526 1526 - 1526 Select org.make.core.operation.OidcConfiguration.apply$default$9 org.make.api.makeunittest org.make.core.operation.OidcConfiguration.apply$default$9
45 51457 1552 - 1556 Select scala.None org.make.api.makeunittest scala.None
45 51801 1544 - 1546 Literal <nosymbol> org.make.api.makeunittest ""
45 51768 1526 - 1526 Select org.make.core.operation.OidcConfiguration.apply$default$7 org.make.api.makeunittest org.make.core.operation.OidcConfiguration.apply$default$7
45 51624 1548 - 1550 Literal <nosymbol> org.make.api.makeunittest ""
45 51651 1562 - 1564 Literal <nosymbol> org.make.api.makeunittest ""
46 51671 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 51460 1651 - 1688 Apply org.make.core.operation.OperationId.apply org.make.api.makeunittest org.make.core.operation.OperationId.apply("oidc-secured-operation")
48 51756 1701 - 1725 Literal <nosymbol> org.make.api.makeunittest "oidc-secured-operation"
49 51670 1740 - 1743 Select scala.Nil org.make.api.makeunittest scala.`package`.Nil
50 51502 1761 - 1764 Select scala.Nil org.make.api.makeunittest scala.`package`.Nil
51 51760 1786 - 1805 Select org.make.core.operation.OperationKind.SecuredConsultation org.make.api.makeunittest org.make.core.operation.OperationKind.SecuredConsultation
52 51644 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)))
52 51796 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 51418 1873 - 1896 Apply scala.Some.apply org.make.api.makeunittest scala.Some.apply[org.make.core.operation.OidcConfiguration](MakeUnitTest.this.oidcConfiguration)
52 51609 1878 - 1895 Select org.make.api.MakeUnitTest.oidcConfiguration org.make.api.makeunittest MakeUnitTest.this.oidcConfiguration
53 51463 1916 - 1920 Select scala.None org.make.api.makeunittest scala.None
54 51746 1938 - 1942 Select scala.None org.make.api.makeunittest scala.None
56 51596 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 51491 2022 - 2057 Apply org.make.core.question.QuestionId.apply org.make.api.makeunittest org.make.core.question.QuestionId.apply("oidc-secured-question")
58 51783 2070 - 2093 Literal <nosymbol> org.make.api.makeunittest "oidc-secured-question"
59 51440 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"))
59 51612 2127 - 2140 Apply org.make.core.reference.Country.apply org.make.api.makeunittest org.make.core.reference.Country.apply("FR")
60 51798 2165 - 2179 Apply org.make.core.reference.Language.apply org.make.api.makeunittest org.make.core.reference.Language.apply("fr")
61 51647 2213 - 2227 Apply org.make.core.reference.Language.apply org.make.api.makeunittest org.make.core.reference.Language.apply("fr")
61 51455 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"))
62 51749 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 51655 2310 - 2314 Select scala.None org.make.api.makeunittest scala.None
64 51493 2339 - 2371 Select org.make.core.operation.Operation.operationId org.make.api.makeunittest MakeUnitTest.this.oidcSecuredOperation.operationId
64 51785 2334 - 2372 Apply scala.Some.apply org.make.api.makeunittest scala.Some.apply[org.make.core.operation.OperationId](MakeUnitTest.this.oidcSecuredOperation.operationId)
67 51761 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$15 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$15
67 51438 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$17 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$17
67 51450 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$11 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$11
67 51728 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$21 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$21
67 51477 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$30 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$30
67 51578 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$13 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$13
67 51650 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$19 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$19
67 51722 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 51599 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$7 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$7
67 51485 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$33 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$33
67 51721 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$28 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$28
67 51739 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$31 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$31
67 51697 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$18 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$18
67 51733 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$12 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$12
67 51637 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$10 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$10
67 51580 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$22 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$22
67 51634 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$29 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$29
67 51508 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$23 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$23
67 51589 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$16 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$16
67 51430 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$36 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$36
67 51780 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$34 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$34
67 51789 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$24 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$24
67 51496 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$5 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$5
67 51487 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$14 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$14
67 51442 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$27 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$27
67 51615 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$35 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$35
67 51591 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$26 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$26
67 51582 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$32 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$32
67 51794 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$9 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$9
67 51453 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$20 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$20
67 51435 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$8 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$8
67 51758 2451 - 2451 Select org.make.api.TestUtils.operationOfQuestion$default$6 org.make.api.makeunittest MakeUnitTest.this.operationOfQuestion$default$6
68 51441 2478 - 2508 Select org.make.core.question.Question.questionId org.make.api.makeunittest MakeUnitTest.this.oidcSecuredQuestion.questionId
69 51793 2516 - 2548 Select org.make.core.operation.Operation.operationId org.make.api.makeunittest MakeUnitTest.this.oidcSecuredOperation.operationId
70 51636 2568 - 2616 Apply java.time.ZonedDateTime.parse org.make.api.makeunittest java.time.ZonedDateTime.parse("2018-10-21T10:15:30+00:00")
71 51459 2634 - 2682 Apply java.time.ZonedDateTime.parse org.make.api.makeunittest java.time.ZonedDateTime.parse("2068-10-21T10:15:30+00:00")
72 51731 2709 - 2737 Select org.make.core.operation.ResultsLink.Internal.Results org.make.api.makeunittest org.make.core.operation.ResultsLink.Internal.Results
72 51562 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)