package cz.moneta.test.regression.commercial.auto.autoapi.codebooks;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.harness.annotations.JiraTestCase;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;
import cz.moneta.test.harness.support.auth.Credentials;
import cz.moneta.test.harness.support.auth.Key;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;

import static cz.moneta.test.dsl.util.credentials.Keys.smart;

@Disabled
@TestScenario(name = "Sending REST request to get authentication TOKEN")
public class TokenTest {

    @JiraTestCase(id = "LAMD-T1033")
    @TestCase(name = "Call POST /lamder/authentication/login")
    public void tcGetToken(Harness harness, @Key(smart.auto.general) Credentials credentials) {
        String token = harness.withAutoApi()
                .lamder()
                .authentication()
                .prepareLoginRequest()
                .password(credentials.getPassword())
                .userName(credentials.getUsername())
                .securityCode("")
                .send()
                .getAccessToken()
                .getToken();

        harness.log("Authorization token from response is: " + token);

        Assertions.assertNotNull(token);
    }
}