1# Copyright 2021-2022 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# -----------------------------------------------------------------------------
16# Imports
17# -----------------------------------------------------------------------------
18
19
20# -----------------------------------------------------------------------------
21def test_import():
22    from bumble import (
23        att,
24        bridge,
25        company_ids,
26        controller,
27        core,
28        crypto,
29        device,
30        hci,
31        hfp,
32        host,
33        keys,
34        l2cap,
35        link,
36        rfcomm,
37        sdp,
38        smp,
39        transport,
40        utils,
41    )
42
43    from bumble.profiles import (
44        ascs,
45        bap,
46        bass,
47        battery_service,
48        cap,
49        csip,
50        device_information_service,
51        gap,
52        heart_rate_service,
53        le_audio,
54        pacs,
55        pbp,
56        vcp,
57    )
58
59    assert att
60    assert bridge
61    assert company_ids
62    assert controller
63    assert core
64    assert crypto
65    assert device
66    assert hci
67    assert hfp
68    assert host
69    assert keys
70    assert l2cap
71    assert link
72    assert rfcomm
73    assert sdp
74    assert smp
75    assert transport
76    assert utils
77
78    assert ascs
79    assert bap
80    assert bass
81    assert battery_service
82    assert cap
83    assert csip
84    assert device_information_service
85    assert gap
86    assert heart_rate_service
87    assert le_audio
88    assert pacs
89    assert pbp
90    assert vcp
91
92
93# -----------------------------------------------------------------------------
94def test_app_imports():
95    from apps.console import main
96
97    assert main
98
99    from apps.controller_info import main
100
101    assert main
102
103    from apps.controllers import main
104
105    assert main
106
107    from apps.gatt_dump import main
108
109    assert main
110
111    from apps.gg_bridge import main
112
113    assert main
114
115    from apps.hci_bridge import main
116
117    assert main
118
119    from apps.pair import main
120
121    assert main
122
123    from apps.scan import main
124
125    assert main
126
127    from apps.show import main
128
129    assert main
130
131    from apps.unbond import main
132
133    assert main
134
135    from apps.usb_probe import main
136
137    assert main
138
139
140# -----------------------------------------------------------------------------
141def test_profiles_imports():
142    from bumble.profiles import (
143        battery_service,
144        device_information_service,
145        heart_rate_service,
146    )
147
148    assert battery_service
149    assert device_information_service
150    assert heart_rate_service
151
152
153# -----------------------------------------------------------------------------
154if __name__ == '__main__':
155    test_import()
156    test_app_imports()
157    test_profiles_imports()
158