1212
1313
1414@pytest .fixture (scope = "module" )
15- def client () -> AtlanClient :
16- return AtlanClient ()
15+ def m_client () -> AtlanClient :
16+ from os import environ
17+
18+ client = AtlanClient (
19+ base_url = environ ["MARK_BASE_URL" ], api_key = environ ["MARK_API_KEY" ]
20+ )
21+ AtlanClient .register_client (client )
22+ return client
1723
1824
1925@pytest .fixture (scope = "module" )
20- def connection (client : AtlanClient ) -> Connection :
21- return client .get_asset_by_guid ("b3a5c49a-0c7c-4e66-8453-f4da8d9ce222" , Connection )
26+ def connection (m_client ) -> Connection :
27+ return m_client .get_asset_by_guid (
28+ "b3a5c49a-0c7c-4e66-8453-f4da8d9ce222" , Connection
29+ )
2230
2331
2432@pytest .fixture (scope = "module" )
25- def glossary (client : AtlanClient ) -> Generator [AtlasGlossary , None , None ]:
33+ def glossary (m_client : AtlanClient ) -> Generator [AtlasGlossary , None , None ]:
2634 glossary = AtlasGlossary .create (name = "Integration Test Glossary" )
27- glossary = client .upsert (glossary ).assets_created (asset_type = AtlasGlossary )[0 ]
35+ glossary = m_client .upsert (glossary ).assets_created (asset_type = AtlasGlossary )[0 ]
2836 yield glossary
29- client .purge_entity_by_guid (guid = glossary .guid )
37+ m_client .purge_entity_by_guid (guid = glossary .guid )
3038
3139
3240@pytest .fixture ()
3341def database (
34- client : AtlanClient , connection : Connection
42+ m_client : AtlanClient , connection : Connection
3543) -> Generator [Database , None , None ]:
3644 database = Database .create (
3745 name = f"Integration_Test_Entity_DB{ next (iter_count )} " ,
3846 connection_qualified_name = connection .attributes .qualified_name ,
3947 )
40- database = client .upsert (database ).assets_created (Database )[0 ]
48+ database = m_client .upsert (database ).assets_created (Database )[0 ]
4149
4250 yield database
4351
44- client .purge_entity_by_guid (guid = database .guid )
52+ m_client .purge_entity_by_guid (guid = database .guid )
4553
4654
4755@pytest .fixture ()
4856def make_term (
49- client : AtlanClient , glossary
57+ m_client : AtlanClient , glossary
5058) -> Generator [Callable [[str ], AtlasGlossaryTerm ], None , None ]:
5159 created_term_guids = []
5260
5361 def _make_term (name : str ) -> AtlasGlossaryTerm :
5462 term = AtlasGlossaryTerm .create (
5563 name = f"Integration Test Glossary Term { name } " , anchor = glossary
5664 )
57- term = client .upsert (term ).assets_created (AtlasGlossaryTerm )[0 ]
65+ term = m_client .upsert (term ).assets_created (AtlasGlossaryTerm )[0 ]
5866 created_term_guids .append (term .guid )
5967 return term
6068
6169 yield _make_term
6270
6371 for guid in created_term_guids :
64- client .purge_entity_by_guid (guid = guid )
72+ m_client .purge_entity_by_guid (guid = guid )
6573
6674
6775def test_register_client_with_bad_parameter_raises_valueerror ():
@@ -77,66 +85,66 @@ def test_register_client():
7785
7886
7987def test_append_terms_with_guid (
80- client : AtlanClient ,
88+ m_client : AtlanClient ,
8189 make_term : Callable [[str ], AtlasGlossaryTerm ],
8290 database : Database ,
8391):
8492 term = make_term ("Term1" )
8593
8694 assert (
87- database := client .append_terms (
95+ database := m_client .append_terms (
8896 guid = database .guid , asset_type = Database , terms = [term ]
8997 )
9098 )
91- database = client .get_asset_by_guid (guid = database .guid , asset_type = Database )
99+ database = m_client .get_asset_by_guid (guid = database .guid , asset_type = Database )
92100 assert len (database .terms ) == 1
93101 assert database .terms [0 ].guid == term .guid
94102
95103
96104def test_append_terms_with_qualified_name (
97- client : AtlanClient ,
105+ m_client : AtlanClient ,
98106 make_term : Callable [[str ], AtlasGlossaryTerm ],
99107 database : Database ,
100108):
101109 term = make_term ("Term1" )
102110
103111 assert (
104- database := client .append_terms (
112+ database := m_client .append_terms (
105113 qualified_name = database .qualified_name , asset_type = Database , terms = [term ]
106114 )
107115 )
108- database = client .get_asset_by_guid (guid = database .guid , asset_type = Database )
116+ database = m_client .get_asset_by_guid (guid = database .guid , asset_type = Database )
109117 assert len (database .terms ) == 1
110118 assert database .terms [0 ].guid == term .guid
111119
112120
113121def test_append_terms_using_ref_by_guid_for_term (
114- client : AtlanClient ,
122+ m_client : AtlanClient ,
115123 make_term : Callable [[str ], AtlasGlossaryTerm ],
116124 database : Database ,
117125):
118126 term = make_term ("Term1" )
119127
120128 assert (
121- database := client .append_terms (
129+ database := m_client .append_terms (
122130 qualified_name = database .qualified_name ,
123131 asset_type = Database ,
124132 terms = [AtlasGlossaryTerm .ref_by_guid (guid = term .guid )],
125133 )
126134 )
127- database = client .get_asset_by_guid (guid = database .guid , asset_type = Database )
135+ database = m_client .get_asset_by_guid (guid = database .guid , asset_type = Database )
128136 assert len (database .terms ) == 1
129137 assert database .terms [0 ].guid == term .guid
130138
131139
132140def test_replace_a_term (
133- client : AtlanClient ,
141+ m_client : AtlanClient ,
134142 make_term : Callable [[str ], AtlasGlossaryTerm ],
135143 database : Database ,
136144):
137145 original_term = make_term ("Term1" )
138146 assert (
139- database := client .append_terms (
147+ database := m_client .append_terms (
140148 qualified_name = database .qualified_name ,
141149 asset_type = Database ,
142150 terms = [AtlasGlossaryTerm .ref_by_guid (guid = original_term .guid )],
@@ -145,12 +153,12 @@ def test_replace_a_term(
145153
146154 replacemant_term = make_term ("Term2" )
147155 assert (
148- database := client .replace_terms (
156+ database := m_client .replace_terms (
149157 guid = database .guid , asset_type = Database , terms = [replacemant_term ]
150158 )
151159 )
152160
153- database = client .get_asset_by_guid (guid = database .guid , asset_type = Database )
161+ database = m_client .get_asset_by_guid (guid = database .guid , asset_type = Database )
154162 assert len (database .terms ) == 2
155163 deleted_terms = [t for t in database .terms if t .relationship_status == "DELETED" ]
156164 assert len (deleted_terms ) == 1
@@ -161,41 +169,41 @@ def test_replace_a_term(
161169
162170
163171def test_replace_all_term (
164- client : AtlanClient ,
172+ m_client : AtlanClient ,
165173 make_term : Callable [[str ], AtlasGlossaryTerm ],
166174 database : Database ,
167175):
168176 original_term = make_term ("Term1" )
169177 assert (
170- database := client .append_terms (
178+ database := m_client .append_terms (
171179 qualified_name = database .qualified_name ,
172180 asset_type = Database ,
173181 terms = [AtlasGlossaryTerm .ref_by_guid (guid = original_term .guid )],
174182 )
175183 )
176184
177185 assert (
178- database := client .replace_terms (
186+ database := m_client .replace_terms (
179187 guid = database .guid , asset_type = Database , terms = []
180188 )
181189 )
182190
183- database = client .get_asset_by_guid (guid = database .guid , asset_type = Database )
191+ database = m_client .get_asset_by_guid (guid = database .guid , asset_type = Database )
184192 assert len (database .terms ) == 1
185193 deleted_terms = [t for t in database .terms if t .relationship_status == "DELETED" ]
186194 assert len (deleted_terms ) == 1
187195 assert deleted_terms [0 ].guid == original_term .guid
188196
189197
190198def test_remove_term (
191- client : AtlanClient ,
199+ m_client : AtlanClient ,
192200 make_term : Callable [[str ], AtlasGlossaryTerm ],
193201 database : Database ,
194202):
195203 original_term = make_term ("Term1" )
196204 another_term = make_term ("Term2" )
197205 assert (
198- database := client .append_terms (
206+ database := m_client .append_terms (
199207 qualified_name = database .qualified_name ,
200208 asset_type = Database ,
201209 terms = [
@@ -206,14 +214,14 @@ def test_remove_term(
206214 )
207215
208216 assert (
209- database := client .remove_terms (
217+ database := m_client .remove_terms (
210218 guid = database .guid ,
211219 asset_type = Database ,
212220 terms = [AtlasGlossaryTerm .ref_by_guid (original_term .guid )],
213221 )
214222 )
215223
216- database = client .get_asset_by_guid (guid = database .guid , asset_type = Database )
224+ database = m_client .get_asset_by_guid (guid = database .guid , asset_type = Database )
217225 assert len (database .terms ) == 2
218226 deleted_terms = [t for t in database .terms if t .relationship_status == "DELETED" ]
219227 assert len (deleted_terms ) == 1
@@ -222,8 +230,8 @@ def test_remove_term(
222230 assert active_terms [0 ].guid == another_term .guid
223231
224232
225- def test_find_connections_by_name (client : AtlanClient ):
226- connections = client .find_connections_by_name (
233+ def test_find_connections_by_name (m_client : AtlanClient ):
234+ connections = m_client .find_connections_by_name (
227235 name = "Test Connection" ,
228236 connector_type = AtlanConnectorType .SNOWFLAKE ,
229237 attributes = ["connectorName" ],
@@ -232,8 +240,8 @@ def test_find_connections_by_name(client: AtlanClient):
232240 assert connections [0 ].connector_name == AtlanConnectorType .SNOWFLAKE .value
233241
234242
235- def test_get_lineage (client : AtlanClient ):
236- response = client .get_lineage (
243+ def test_get_lineage (m_client : AtlanClient ):
244+ response = m_client .get_lineage (
237245 LineageRequest (guid = "75474eab-3105-4ef9-9f84-709e386a7d3e" )
238246 )
239247 for guid , asset in response .guid_entity_map .items ():
0 commit comments