88from fastapi .testclient import TestClient
99import pytest
1010import labthings_fastapi as lt
11- from labthings_fastapi .outputs .blob import blob_type
12- from labthings_fastapi .client import ThingClient
1311
1412
1513class TextBlob (lt .blob .Blob ):
@@ -71,8 +69,8 @@ def check_passthrough(self, thing_one: ThingOneDep) -> bool:
7169def test_blob_type ():
7270 """Check we can't put dodgy values into a blob output model"""
7371 with pytest .raises (ValueError ):
74- blob_type (media_type = "text/plain\\ 'DROP TABLES" )
75- M = blob_type (media_type = "text/plain" )
72+ lt . blob . blob_type (media_type = "text/plain\\ 'DROP TABLES" )
73+ M = lt . blob . blob_type (media_type = "text/plain" )
7674 assert M .from_bytes (b"" ).media_type == "text/plain"
7775
7876
@@ -99,7 +97,7 @@ def test_blob_output_client():
9997 server = lt .ThingServer ()
10098 server .add_thing (ThingOne (), "/thing_one" )
10199 with TestClient (server .app ) as client :
102- tc = ThingClient .from_url ("/thing_one/" , client = client )
100+ tc = lt . ThingClient .from_url ("/thing_one/" , client = client )
103101 check_actions (tc )
104102
105103
@@ -115,7 +113,7 @@ def test_blob_output_inserver():
115113 server .add_thing (ThingOne (), "/thing_one" )
116114 server .add_thing (ThingTwo (), "/thing_two" )
117115 with TestClient (server .app ) as client :
118- tc = ThingClient .from_url ("/thing_two/" , client = client )
116+ tc = lt . ThingClient .from_url ("/thing_two/" , client = client )
119117 output = tc .check_both ()
120118 assert output is True
121119
@@ -145,7 +143,7 @@ def test_blob_input():
145143 server .add_thing (ThingOne (), "/thing_one" )
146144 server .add_thing (ThingTwo (), "/thing_two" )
147145 with TestClient (server .app ) as client :
148- tc = ThingClient .from_url ("/thing_one/" , client = client )
146+ tc = lt . ThingClient .from_url ("/thing_one/" , client = client )
149147 output = tc .action_one ()
150148 print (f"Output is { output } " )
151149 assert output is not None
@@ -157,7 +155,7 @@ def test_blob_input():
157155 assert passthrough .content == ThingOne .ACTION_ONE_RESULT
158156
159157 # Check that the same thing works on the server side
160- tc2 = ThingClient .from_url ("/thing_two/" , client = client )
158+ tc2 = lt . ThingClient .from_url ("/thing_two/" , client = client )
161159 assert tc2 .check_passthrough () is True
162160
163161
0 commit comments