<commit_before>package geb.de.iteratec.osm.csi

import de.iteratec.osm.csi.CsTargetGraph
import de.iteratec.osm.csi.CsTargetValue
import de.iteratec.osm.csi.TestDataUtil
import de.iteratec.osm.security.User
import geb.CustomUrlGebReportingSpec
import geb.IgnoreGebLiveTest
import geb.pages.de.iteratec.osm.csi.CsTargetGraphCreatePage
import geb.pages.de.iteratec.osm.csi.CsTargetGraphEditPage
import geb.pages.de.iteratec.osm.csi.CsTargetGraphIndexPage
import geb.pages.de.iteratec.osm.csi.CsTargetGraphShowPage
import grails.test.mixin.integration.Integration
import grails.transaction.Rollback
import org.openqa.selenium.Keys
import spock.lang.IgnoreIf
import spock.lang.Shared
import spock.lang.Stepwise

/**
 * Tests the CRUD View of {@link de.iteratec.osm.csi.CsTargetGraph}* Most TestCases can't be run agains liveInstance beacause there have to be some CsTargetValues
 */
@Integration
@Rollback
@Stepwise
class CsTargetGraphGebSpec extends CustomUrlGebReportingSpec {

    private static final targetGraphLabel = "geb test target graph"
    private static final targetGraphDescription = "a geb test cs target graph description"
    @Shared
    private CsTargetValue pointOne
    @Shared
    private CsTargetValue pointTwo
    @Shared
    Long csTargetGraphId

    void cleanupSpec() {
        doLogout()
    }

    def setupData() {
        CsTargetValue.withNewTransaction {
            pointOne = new CsTargetValue(date: new Date().minus(2), csInPercent: 30).save(failOnError: true)
            pointTwo = new CsTargetValue(date: new Date(), csInPercent: 20).save(failOnError: true)
        }
    }

    def cleanupData() {
        CsTargetGraph.findById(csTargetGraphId)?.delete(flush: true)
        pointOne.delete()
        pointTwo.delete()
    }

    void "test user gets to csTargetGraph list when logged in"() {
        given: "User is logged in"
        User.withNewTransaction {
            TestDataUtil.createOsmConfig()
            TestDataUtil.createAdminUser()
        }<commit_msg>[IT-1987] remove TestData from CsTargetGraphGebSpec<commit_after>package geb.de.iteratec.osm.csi

import de.iteratec.osm.OsmConfiguration
import de.iteratec.osm.csi.CsTargetGraph
import de.iteratec.osm.csi.CsTargetValue
import de.iteratec.osm.security.User
import geb.CustomUrlGebReportingSpec
import geb.IgnoreGebLiveTest
import geb.pages.de.iteratec.osm.csi.CsTargetGraphCreatePage
import geb.pages.de.iteratec.osm.csi.CsTargetGraphEditPage
import geb.pages.de.iteratec.osm.csi.CsTargetGraphIndexPage
import geb.pages.de.iteratec.osm.csi.CsTargetGraphShowPage
import grails.test.mixin.integration.Integration
import grails.transaction.Rollback
import org.openqa.selenium.Keys
import spock.lang.IgnoreIf
import spock.lang.Shared
import spock.lang.Stepwise
/**
 * Tests the CRUD View of {@link de.iteratec.osm.csi.CsTargetGraph}* Most TestCases can't be run agains liveInstance beacause there have to be some CsTargetValues
 */
@Integration
@Rollback
@Stepwise
class CsTargetGraphGebSpec extends CustomUrlGebReportingSpec {

    private static final targetGraphLabel = "geb test target graph"
    private static final targetGraphDescription = "a geb test cs target graph description"
    @Shared
    private CsTargetValue pointOne
    @Shared
    private CsTargetValue pointTwo
    @Shared
    Long csTargetGraphId

    void cleanupSpec() {
        doLogout()
    }

    def setupData() {
        CsTargetValue.withNewTransaction {
            pointOne = new CsTargetValue(date: new Date().minus(2), csInPercent: 30).save(failOnError: true)
            pointTwo = new CsTargetValue(date: new Date(), csInPercent: 20).save(failOnError: true)
        }
    }

    def cleanupData() {
        CsTargetGraph.findById(csTargetGraphId)?.delete(flush: true)
        pointOne.delete()
        pointTwo.delete()
    }

    void "test user gets to csTargetGraph list when logged in"() {
        given: "User is logged in"
        User.withNewTransaction {
            OsmConfiguration.build()
            createAdminUser()
        }
{'fraction_non_alphanumeric': 0.08320914058618976, 'fraction_numerical': 0.003477396920019871, 'mean_word_length': 3.7432273262661955, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5110274', 'n_tokens_mistral': 1298, 'n_tokens_neox': 1217, 'n_words': 280}