Skip to content

Commit 0c85729

Browse files
committed
fix login utils tests
1 parent 8a75db9 commit 0c85729

File tree

1 file changed

+81
-20
lines changed

1 file changed

+81
-20
lines changed

tests/functional/adapter/test_utils.py

Lines changed: 81 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,34 @@
2929
from dbt.tests.adapter.utils.test_split_part import BaseSplitPart
3030
from dbt.tests.adapter.utils.test_string_literal import BaseStringLiteral
3131

32+
macros__test_assert_equal_sql = """
33+
{% test assert_equal(model, actual, expected) %}
34+
select * from {{ model }}
35+
where {{ actual }} != {{ expected }}
36+
or ({{ actual }} is null and {{ expected }} is not null)
37+
or ({{ expected }} is null and {{ actual }} is not null)
38+
{% endtest %}
39+
"""
40+
3241

3342
class TestAnyValueSQLServer(BaseAnyValue):
34-
pass
43+
@pytest.fixture(scope="class")
44+
def macros(self):
45+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
3546

3647

3748
@pytest.mark.skip("bool_or not supported in this adapter")
3849
class TestBoolOrSQLServer(BaseBoolOr):
39-
pass
50+
@pytest.fixture(scope="class")
51+
def macros(self):
52+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
4053

4154

4255
class TestCastBoolToTextSQLServer(BaseCastBoolToText):
56+
@pytest.fixture(scope="class")
57+
def macros(self):
58+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
59+
4360
@pytest.fixture(scope="class")
4461
def models(self):
4562
models__test_cast_bool_to_text_sql = """
@@ -68,50 +85,74 @@ def models(self):
6885

6986

7087
class TestConcatSQLServer(BaseConcat):
71-
pass
88+
@pytest.fixture(scope="class")
89+
def macros(self):
90+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
7291

7392

7493
class TestDateTruncSQLServer(BaseDateTrunc):
75-
pass
94+
@pytest.fixture(scope="class")
95+
def macros(self):
96+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
7697

7798

7899
class TestHashSQLServer(BaseHash):
79-
pass
100+
@pytest.fixture(scope="class")
101+
def macros(self):
102+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
80103

81104

82105
class TestStringLiteralSQLServer(BaseStringLiteral):
83-
pass
106+
@pytest.fixture(scope="class")
107+
def macros(self):
108+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
84109

85110

86111
class TestSplitPartSQLServer(BaseSplitPart):
87-
pass
112+
@pytest.fixture(scope="class")
113+
def macros(self):
114+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
88115

89116

90117
class TestDateDiffSQLServer(BaseDateDiff):
91-
pass
118+
@pytest.fixture(scope="class")
119+
def macros(self):
120+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
92121

93122

94123
class TestEscapeSingleQuotesSQLServer(BaseEscapeSingleQuotesQuote):
95-
pass
124+
@pytest.fixture(scope="class")
125+
def macros(self):
126+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
96127

97128

98129
class TestIntersectSQLServer(BaseIntersect):
99-
pass
130+
@pytest.fixture(scope="class")
131+
def macros(self):
132+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
100133

101134

102135
class TestLastDaySQLServer(BaseLastDay):
103-
pass
136+
@pytest.fixture(scope="class")
137+
def macros(self):
138+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
104139

105140

106141
class TestLengthSQLServer(BaseLength):
107-
pass
142+
@pytest.fixture(scope="class")
143+
def macros(self):
144+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
108145

109146

110147
class TestListaggSQLServer(BaseListagg):
111148
# Only supported in SQL Server 2017 and later or cloud versions
112149
# DISTINCT not supported
113150
# limit not supported
114151

152+
@pytest.fixture(scope="class")
153+
def macros(self):
154+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
155+
115156
@pytest.fixture(scope="class")
116157
def seeds(self):
117158
seeds__data_listagg_output_csv = """group_col,expected,version
@@ -191,14 +232,22 @@ def models(self):
191232

192233

193234
class TestRightSQLServer(BaseRight):
194-
pass
235+
@pytest.fixture(scope="class")
236+
def macros(self):
237+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
195238

196239

197240
class TestSafeCastSQLServer(BaseSafeCast):
198-
pass
241+
@pytest.fixture(scope="class")
242+
def macros(self):
243+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
199244

200245

201246
class TestDateAddSQLServer(BaseDateAdd):
247+
@pytest.fixture(scope="class")
248+
def macros(self):
249+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
250+
202251
@pytest.fixture(scope="class")
203252
def project_config_update(self):
204253
return {
@@ -217,15 +266,21 @@ def project_config_update(self):
217266

218267

219268
class TestExceptSQLServer(BaseExcept):
220-
pass
269+
@pytest.fixture(scope="class")
270+
def macros(self):
271+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
221272

222273

223274
class TestPositionSQLServer(BasePosition):
224-
pass
275+
@pytest.fixture(scope="class")
276+
def macros(self):
277+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
225278

226279

227280
class TestReplaceSQLServer(BaseReplace):
228-
pass
281+
@pytest.fixture(scope="class")
282+
def macros(self):
283+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
229284

230285

231286
class TestCurrentTimestampSQLServer(BaseCurrentTimestampNaive):
@@ -234,14 +289,20 @@ class TestCurrentTimestampSQLServer(BaseCurrentTimestampNaive):
234289

235290
@pytest.mark.skip(reason="arrays not supported")
236291
class TestArrayAppendSQLServer(BaseArrayAppend):
237-
pass
292+
@pytest.fixture(scope="class")
293+
def macros(self):
294+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
238295

239296

240297
@pytest.mark.skip(reason="arrays not supported")
241298
class TestArrayConcatSQLServer(BaseArrayConcat):
242-
pass
299+
@pytest.fixture(scope="class")
300+
def macros(self):
301+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}
243302

244303

245304
@pytest.mark.skip(reason="arrays not supported")
246305
class TestArrayConstructSQLServer(BaseArrayConstruct):
247-
pass
306+
@pytest.fixture(scope="class")
307+
def macros(self):
308+
return {"test_assert_equal.sql": macros__test_assert_equal_sql}

0 commit comments

Comments
 (0)