@@ -47,7 +47,9 @@ def test_exporter_dump_json():
4747 "uuid": "f4cf49ab-fc64-46c6-94e7-a40502eb77b1"
4848 }
4949 ],
50- "endpoint": "https://test-exporter"
50+ "endpoint": "https://test-exporter",
51+ "exporterStatus": null,
52+ "statusMessage": null
5153 }
5254}"""
5355 )
@@ -73,6 +75,8 @@ def test_exporter_dump_yaml():
7375 test: label
7476 uuid: f4cf49ab-fc64-46c6-94e7-a40502eb77b1
7577 endpoint: https://test-exporter
78+ exporterStatus: null
79+ statusMessage: null
7680"""
7781 )
7882
@@ -113,8 +117,9 @@ def test_exporter_rich_add_columns_without_devices():
113117
114118 mock_table = MagicMock ()
115119 V1Alpha1Exporter .rich_add_columns (mock_table , devices = False )
116- assert mock_table .add_column .call_count == 4
120+ assert mock_table .add_column .call_count == 5
117121 mock_table .add_column .assert_any_call ("NAME" , no_wrap = True )
122+ mock_table .add_column .assert_any_call ("STATUS" )
118123 mock_table .add_column .assert_any_call ("ENDPOINT" )
119124 mock_table .add_column .assert_any_call ("DEVICES" )
120125 mock_table .add_column .assert_any_call ("AGE" )
@@ -128,8 +133,9 @@ def test_exporter_rich_add_columns_with_devices():
128133
129134 mock_table = MagicMock ()
130135 V1Alpha1Exporter .rich_add_columns (mock_table , devices = True )
131- assert mock_table .add_column .call_count == 5
136+ assert mock_table .add_column .call_count == 6
132137 mock_table .add_column .assert_any_call ("NAME" , no_wrap = True )
138+ mock_table .add_column .assert_any_call ("STATUS" )
133139 mock_table .add_column .assert_any_call ("ENDPOINT" )
134140 mock_table .add_column .assert_any_call ("AGE" )
135141 mock_table .add_column .assert_any_call ("LABELS" )
@@ -146,9 +152,10 @@ def test_exporter_rich_add_rows_without_devices():
146152 mock_table .add_row .assert_called_once ()
147153 args = mock_table .add_row .call_args [0 ]
148154 assert args [0 ] == "test-exporter"
149- assert args [1 ] == "https://test-exporter"
150- assert args [2 ] == "1" # Number of devices
151- assert args [3 ] == "5m" # Age
155+ assert args [1 ] == "Unknown" # Status (shows "Unknown" when exporter_status is None)
156+ assert args [2 ] == "https://test-exporter"
157+ assert args [3 ] == "1" # Number of devices
158+ assert args [4 ] == "5m" # Age
152159
153160
154161def test_exporter_rich_add_rows_with_devices ():
@@ -161,10 +168,11 @@ def test_exporter_rich_add_rows_with_devices():
161168 mock_table .add_row .assert_called_once ()
162169 args = mock_table .add_row .call_args [0 ]
163170 assert args [0 ] == "test-exporter"
164- assert args [1 ] == "https://test-exporter"
165- assert args [2 ] == "5m" # Age
166- assert args [3 ] == "test:label" # Labels
167- assert args [4 ] == "f4cf49ab-fc64-46c6-94e7-a40502eb77b1" # UUID
171+ assert args [1 ] == "Unknown" # Status (shows "Unknown" when exporter_status is None)
172+ assert args [2 ] == "https://test-exporter"
173+ assert args [3 ] == "5m" # Age
174+ assert args [4 ] == "test:label" # Labels
175+ assert args [5 ] == "f4cf49ab-fc64-46c6-94e7-a40502eb77b1" # UUID
168176
169177
170178def test_exporter_rich_add_names ():
@@ -212,7 +220,7 @@ def test_exporter_list_rich_add_columns():
212220
213221 mock_table = MagicMock ()
214222 V1Alpha1ExporterList .rich_add_columns (mock_table , devices = False )
215- assert mock_table .add_column .call_count == 4
223+ assert mock_table .add_column .call_count == 5
216224
217225
218226def test_exporter_list_rich_add_columns_with_devices ():
@@ -223,7 +231,7 @@ def test_exporter_list_rich_add_columns_with_devices():
223231
224232 mock_table = MagicMock ()
225233 V1Alpha1ExporterList .rich_add_columns (mock_table , devices = True )
226- assert mock_table .add_column .call_count == 5
234+ assert mock_table .add_column .call_count == 6
227235
228236
229237def test_exporter_list_rich_add_rows ():
0 commit comments