load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest")

oncall("secure_pipes")

cpp_unittest(
    name = "delegated_credential_types_test",
    srcs = [
        "DelegatedCredTypesTest.cpp",
    ],
    deps = [
        "//fizz/extensions/delegatedcred:delegated_credential",
        "//folly/io:iobuf",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
    ],
)

cpp_unittest(
    name = "serialization_test",
    srcs = [
        "SerializationTest.cpp",
    ],
    deps = [
        "//fizz/extensions/delegatedcred:serialization",
        "//folly:base64",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
    ],
)

cpp_unittest(
    name = "delegated_credential_utils_test",
    srcs = [
        "DelegatedCredentialUtilsTest.cpp",
    ],
    deps = [
        "//fizz/crypto:utils",
        "//fizz/crypto/test:TestUtil",
        "//fizz/extensions/delegatedcred:delegated_credential_utils",
        "//fizz/protocol/clock/test:mock_clock",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//folly/ssl:openssl_cert_utils",
        "//folly/ssl:openssl_ptr_types",
    ],
)

cpp_unittest(
    name = "delegated_credential_factory_test",
    srcs = [
        "DelegatedCredentialFactoryTest.cpp",
    ],
    deps = [
        "//fizz/backend:openssl",
        "//fizz/crypto:utils",
        "//fizz/crypto/test:TestUtil",
        "//fizz/extensions/delegatedcred:delegated_credential_factory",
        "//fizz/extensions/delegatedcred:peer_delegated_credential",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
    ],
)

cpp_unittest(
    name = "peer_delegated_credential_test",
    srcs = [
        "PeerDelegatedCredentialTest.cpp",
    ],
    deps = [
        "//fizz/crypto:utils",
        "//fizz/crypto/test:TestUtil",
        "//fizz/extensions/delegatedcred:peer_delegated_credential",
        "//fizz/protocol/clock/test:mock_clock",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
    ],
)

cpp_unittest(
    name = "self_delegated_credential_test",
    srcs = [
        "SelfDelegatedCredentialTest.cpp",
    ],
    deps = [
        "//fizz/backend:openssl",
        "//fizz/crypto:utils",
        "//fizz/crypto/test:TestUtil",
        "//fizz/extensions/delegatedcred:delegated_credential_utils",
        "//fizz/extensions/delegatedcred:self_delegated_credential",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//folly/ssl:openssl_ptr_types",
    ],
)

cpp_unittest(
    name = "delegated_credential_cert_manager_test",
    srcs = [
        "DelegatedCredentialCertManagerTest.cpp",
    ],
    deps = [
        ":mocks",
        "//fizz/extensions/delegatedcred:delegated_credential_cert_manager",
        "//fizz/protocol/test:mocks",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
    ],
)

cpp_unittest(
    name = "delegated_credential_client_cert_manager_test",
    srcs = [
        "DelegatedCredentialClientCertManagerTest.cpp",
    ],
    deps = [
        "//fizz/extensions/delegatedcred:delegated_credential",
        "//fizz/extensions/delegatedcred:delegated_credential_client_cert_manager",
        "//fizz/protocol/test:mocks",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
    ],
)

cpp_library(
    name = "mocks",
    headers = [
        "Mocks.h",
    ],
    exported_deps = [
        "//fizz/extensions/delegatedcred:self_delegated_credential",
        "//folly/io/async/test:mocks",
    ],
)
