"""Pytest configuration and fixtures."""
import pytest
from cisco_catalog_mcp.config import Settings
@pytest.fixture
def mock_settings() -> Settings:
"""Create mock settings for testing."""
return Settings(
cisco_client_id="test_client_id",
cisco_client_secret="test_client_secret",
cisco_cco_username="test_user",
cisco_cco_password="test_password",
cisco_price_list="GLUS",
)
@pytest.fixture
def sample_item_response() -> dict:
"""Sample response from Get Item Information API."""
return {
"ShowCatalog": {
"ApplicationArea": {
"Sender": {"LogicalID": "364131937", "ReferenceID": "Cisco"},
"Receiver": {"LogicalID": "123456789", "ID": "test_user"},
"CreationDateTime": "2024-01-15T10:30:00Z",
},
"DataArea": {
"Show": {
"ResponseCriteria": {
"ChangeStatus": {
"Code": "CC001H",
"Reason": "Success",
}
}
},
"Catalog": {
"CatalogLine": [
{
"Item": {
"ID": "C9300-24T-E",
"Description": "Catalyst 9300 24-port data only, Network Essentials",
"Classification": {
"ID": [
{"@typeCode": "ProductType", "#text": "Hardware"},
{"@typeCode": "ERPFamily", "#text": "SWITCHES"},
{"@typeCode": "ProductSubGroup", "#text": "Catalyst 9300"},
],
"UNSPSCCode": {
"@listVersionID": "19.0501",
"#text": "43222612",
},
},
"Dimensions": {
"WidthMeasure": {"@unitCode": "in", "#text": "17.5"},
"LengthMeasure": {"@unitCode": "in", "#text": "16.0"},
"HeightMeasure": {"@unitCode": "in", "#text": "1.75"},
"GrossWeightMeasure": {"@unitCode": "lb", "#text": "12.5"},
},
},
"ItemPrice": {
"ID": {"@typeCode": "PriceBookShortName", "#text": "GLUS"},
"UnitPrice": {
"UnitAmount": {
"@currencyCode": "USD",
"#text": "4500.00",
}
},
},
}
]
},
},
}
}
@pytest.fixture
def sample_mapped_service_response() -> dict:
"""Sample response from Get Mapped Service API."""
return {
"ShowCatalog": {
"DataArea": {
"Catalog": {
"CatalogLine": [
{
"Item": {
"ID": "C9300-24T-E",
"Extension": [
{
"ID": [
{"@typeCode": "ServiceProgram", "#text": "SNTC"},
{"@typeCode": "ServiceLevel", "#text": "8X5XNBD"},
{
"@typeCode": "ServiceLevelDescription",
"#text": "8x5xNBD OS SW Support",
},
{"@typeCode": "ServiceSku", "#text": "CON-SNT-C93002TE"},
{
"@typeCode": "ServiceSkuDescription",
"#text": "SNTC-8X5XNBD Catalyst 9300 24-port",
},
],
"Amount": {"@typeCode": "GLUS", "#text": "450.00"},
},
{
"ID": [
{"@typeCode": "ServiceProgram", "#text": "SNTC"},
{"@typeCode": "ServiceLevel", "#text": "24X7X4"},
{
"@typeCode": "ServiceLevelDescription",
"#text": "24x7x4 OS SW Support",
},
{"@typeCode": "ServiceSku", "#text": "CON-SNTP-C93002TE"},
{
"@typeCode": "ServiceSkuDescription",
"#text": "SNTC-24X7X4 Catalyst 9300 24-port",
},
],
"Amount": {"@typeCode": "GLUS", "#text": "675.00"},
},
],
}
}
]
}
}
}
}
@pytest.fixture
def sample_error_response() -> dict:
"""Sample error response from the API."""
return {
"ShowCatalog": {
"DataArea": {
"Show": {
"ResponseCriteria": {
"ChangeStatus": {
"Code": "CC003H",
"Description": "Failure - Service cannot provide any requested data",
"Reason": "Failure",
}
}
},
"Catalog": {},
}
}
}