forked from dbt-labs/dbt-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_contracts_project.py
47 lines (40 loc) · 1.23 KB
/
test_contracts_project.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from .utils import ContractTestCase
from dbt.dataclass_schema import ValidationError
from dbt.contracts.project import Project
class TestProject(ContractTestCase):
ContractType = Project
def test_minimal(self):
dct = {
'name': 'test',
'version': '1.0',
'profile': 'test',
'project-root': '/usr/src/app',
'config-version': 2,
}
project = self.ContractType(
name='test',
version='1.0',
profile='test',
project_root='/usr/src/app',
config_version=2,
)
self.assert_from_dict(project, dct)
def test_invalid_name(self):
dct = {
'name': 'log',
'version': '1.0',
'profile': 'test',
'project-root': '/usr/src/app',
'config-version': 2,
}
with self.assertRaises(ValidationError):
self.ContractType.validate(dct)
def test_unsupported_version(self):
dct = {
'name': 'test',
'version': '1.0',
'profile': 'test',
'project-root': '/usr/src/app',
}
with self.assertRaises(Exception):
self.ContractType.from_dict(dct)