11import pytest
22
3+ from linodecli .exit_codes import ExitCodes
34from tests .integration .helpers import (
45 BASE_CMDS ,
56 assert_headers_in_lines ,
7+ exec_failing_test_command ,
68 exec_test_command ,
79)
810
@@ -62,12 +64,12 @@ def test_service_list():
6264
6365
6466def test_service_view (get_service_type ):
65- dashboard_id = get_service_type
67+ service_type = get_service_type
6668 res = exec_test_command (
6769 BASE_CMDS ["monitor" ]
6870 + [
6971 "service-view" ,
70- dashboard_id ,
72+ service_type ,
7173 "--text" ,
7274 "--delimiter=," ,
7375 ]
@@ -79,12 +81,12 @@ def test_service_view(get_service_type):
7981
8082
8183def test_dashboard_service_type_list (get_service_type ):
82- dashboard_id = get_service_type
84+ service_type = get_service_type
8385 res = exec_test_command (
8486 BASE_CMDS ["monitor" ]
8587 + [
8688 "dashboards-list" ,
87- dashboard_id ,
89+ service_type ,
8890 "--text" ,
8991 "--delimiter=," ,
9092 ]
@@ -96,12 +98,12 @@ def test_dashboard_service_type_list(get_service_type):
9698
9799
98100def test_metrics_list (get_service_type ):
99- dashboard_id = get_service_type
101+ service_type = get_service_type
100102 res = exec_test_command (
101103 BASE_CMDS ["monitor" ]
102104 + [
103105 "metrics-list" ,
104- dashboard_id ,
106+ service_type ,
105107 "--text" ,
106108 "--delimiter=," ,
107109 ]
@@ -117,3 +119,21 @@ def test_metrics_list(get_service_type):
117119 "scrape_interval" ,
118120 ]
119121 assert_headers_in_lines (headers , lines )
122+
123+
124+ def test_try_create_token_with_not_existing_entity (get_service_type ):
125+ service_type = get_service_type
126+ output = exec_failing_test_command (
127+ BASE_CMDS ["monitor" ]
128+ + [
129+ "token-get" ,
130+ service_type ,
131+ "--entity_ids" ,
132+ "99999999999" ,
133+ "--text" ,
134+ "--delimiter=," ,
135+ ],
136+ expected_code = ExitCodes .REQUEST_FAILED ,
137+ )
138+ assert "Request failed: 403" in output
139+ assert "The following entity_ids are not valid - [99999999999]" in output
0 commit comments