package cz.moneta.test.harness.tests.connectors.rest;

import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;
import cz.moneta.test.harness.connectors.rest.BaseRestConnector;
import cz.moneta.test.harness.extensions.SystemVariableExtensionForTest;
import org.junit.Assert;
import org.junit.jupiter.api.extension.ExtendWith;

/**
 * These tests need config=env_test_config setting with PPE environment
 */
@ExtendWith(SystemVariableExtensionForTest.class)
@TestScenario(name = "BaseRestConnector unit tests")
public class BaseRestConnectorTest {

    private BaseRestConnector mockRestConnector = new BaseRestConnector() {
    };

    @TestCase(name = "Test BaseRestConnector getInputStream if trustedStore 'mb_root' is found")
    public void getInputStreamMbRoot() {
        Assert.assertNotNull(mockRestConnector.getInputStream("keystores/mb_root"));
    }

    @TestCase(name = "Test BaseRestConnector getInputStream if trustedStore 'api_gw_client' is found")
    public void getInputStreamApiGwClient() {
        Assert.assertNotNull(mockRestConnector.getInputStream("keystores/api_gw_client.p12"));
    }

    @TestCase(name = "Negative Test BaseRestConnector getInputStream(String name) if trustedStore is NOT found")
    public void getInputStreamNotFound() {
        Assert.assertNull(mockRestConnector.getInputStream("someNonsense"));
    }
}
