Add cloud sprite providers and browser demos
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
from pixellab import PixelLabClient
|
||||
|
||||
|
||||
def test_image_sources_reads_completed_job_images():
|
||||
response = {
|
||||
"last_response": {
|
||||
"images": [{"base64": "data:image/png;base64,AAAA"}],
|
||||
"url": "https://example.com/preview.png",
|
||||
}
|
||||
}
|
||||
assert PixelLabClient.image_sources(response) == [
|
||||
"data:image/png;base64,AAAA",
|
||||
"https://example.com/preview.png",
|
||||
]
|
||||
|
||||
|
||||
def test_create_image_uses_style_endpoint(monkeypatch):
|
||||
client = PixelLabClient(api_key="test")
|
||||
monkeypatch.setattr(client, "_reference", lambda _: {"image": {"base64": "x"}, "width": 64, "height": 64})
|
||||
captured = {}
|
||||
monkeypatch.setattr(client, "_request", lambda method, path, payload: captured.update(method=method, path=path, payload=payload) or {})
|
||||
client.create_image("ship", 64, 64, reference_images=["style.png"])
|
||||
assert captured["path"] == "/generate-with-style-v2"
|
||||
assert captured["payload"]["style_images"][0]["width"] == 64
|
||||
Reference in New Issue
Block a user