@@ -45,19 +45,19 @@ def test_create_question_basic(self, mock_execute):
45
45
call_args = mock_execute .call_args
46
46
47
47
# Check the mutation was called with correct parameters
48
- self . assertEqual ( call_args [0 ][0 ], CREATE_QUESTION )
48
+ assert call_args [0 ][0 ] == CREATE_QUESTION
49
49
50
50
# Check variables
51
51
variables = call_args [1 ]['variables' ]
52
- self . assertEqual ( variables ['question' ]['title' ], "Test Question" )
53
- self . assertEqual ( len (variables ['question' ]['queries' ]), 1 )
54
- self . assertEqual ( variables ['question' ]['queries' ][0 ]['query' ], "FIND Host" )
55
- self . assertEqual ( variables ['question' ]['queries' ][0 ]['name' ], "Query0" )
56
- self . assertEqual ( variables ['question' ]['queries' ][0 ]['resultsAre' ], "INFORMATIVE" )
52
+ assert variables ['question' ]['title' ] == "Test Question"
53
+ assert len (variables ['question' ]['queries' ]) == 1
54
+ assert variables ['question' ]['queries' ][0 ]['query' ] == "FIND Host"
55
+ assert variables ['question' ]['queries' ][0 ]['name' ] == "Query0"
56
+ assert variables ['question' ]['queries' ][0 ]['resultsAre' ] == "INFORMATIVE"
57
57
58
58
# Check result
59
- self . assertEqual ( result ['id' ], "question-123" )
60
- self . assertEqual ( result ['title' ], "Test Question" )
59
+ assert result ['id' ] == "question-123"
60
+ assert result ['title' ] == "Test Question"
61
61
62
62
@patch ('jupiterone.client.JupiterOneClient._execute_query' )
63
63
def test_create_question_with_all_options (self , mock_execute ):
@@ -77,8 +77,7 @@ def test_create_question_with_all_options(self, mock_execute):
77
77
}],
78
78
"tags" : ["security" , "test" ],
79
79
"showTrend" : True ,
80
- "pollingInterval" : "ONE_HOUR" ,
81
- "resourceGroupId" : "rg-123"
80
+ "pollingInterval" : "ONE_HOUR"
82
81
}
83
82
}
84
83
}
@@ -92,7 +91,6 @@ def test_create_question_with_all_options(self, mock_execute):
92
91
"version" : "v1" ,
93
92
"resultsAre" : "BAD"
94
93
}],
95
- resource_group_id = "rg-123" ,
96
94
description = "Complex description" ,
97
95
tags = ["security" , "test" ],
98
96
showTrend = True ,
@@ -103,16 +101,15 @@ def test_create_question_with_all_options(self, mock_execute):
103
101
variables = mock_execute .call_args [1 ]['variables' ]
104
102
question_input = variables ['question' ]
105
103
106
- self .assertEqual (question_input ['title' ], "Complex Question" )
107
- self .assertEqual (question_input ['resourceGroupId' ], "rg-123" )
108
- self .assertEqual (question_input ['description' ], "Complex description" )
109
- self .assertEqual (question_input ['tags' ], ["security" , "test" ])
110
- self .assertEqual (question_input ['showTrend' ], True )
111
- self .assertEqual (question_input ['pollingInterval' ], "ONE_HOUR" )
104
+ assert question_input ['title' ] == "Complex Question"
105
+ assert question_input ['description' ] == "Complex description"
106
+ assert question_input ['tags' ] == ["security" , "test" ]
107
+ assert question_input ['showTrend' ] == True
108
+ assert question_input ['pollingInterval' ] == "ONE_HOUR"
112
109
113
110
# Check result
114
- self . assertEqual ( result ['id' ], "question-456" )
115
- self . assertEqual ( result ['showTrend' ], True )
111
+ assert result ['id' ] == "question-456"
112
+ assert result ['showTrend' ] == True
116
113
117
114
@patch ('jupiterone.client.JupiterOneClient._execute_query' )
118
115
def test_create_question_with_compliance (self , mock_execute ):
@@ -151,12 +148,12 @@ def test_create_question_with_compliance(self, mock_execute):
151
148
variables = mock_execute .call_args [1 ]['variables' ]
152
149
question_input = variables ['question' ]
153
150
154
- self . assertEqual ( question_input ['compliance' ]['standard' ], "CIS" )
155
- self . assertEqual ( question_input ['compliance' ]['requirements' ], ["2.1" , "2.2" ])
156
- self . assertEqual ( question_input ['compliance' ]['controls' ], ["Network Security" ])
151
+ assert question_input ['compliance' ]['standard' ] == "CIS"
152
+ assert question_input ['compliance' ]['requirements' ] == ["2.1" , "2.2" ]
153
+ assert question_input ['compliance' ]['controls' ] == ["Network Security" ]
157
154
158
155
# Check result
159
- self . assertEqual ( result ['compliance' ]['standard' ], "CIS" )
156
+ assert result ['compliance' ]['standard' ] == "CIS"
160
157
161
158
@patch ('jupiterone.client.JupiterOneClient._execute_query' )
162
159
def test_create_question_with_variables (self , mock_execute ):
@@ -198,13 +195,13 @@ def test_create_question_with_variables(self, mock_execute):
198
195
variables = mock_execute .call_args [1 ]['variables' ]
199
196
question_input = variables ['question' ]
200
197
201
- self . assertEqual ( len (question_input ['variables' ]), 1 )
202
- self . assertEqual ( question_input ['variables' ][0 ]['name' ], "environment" )
203
- self . assertEqual ( question_input ['variables' ][0 ]['required' ], True )
204
- self . assertEqual ( question_input ['variables' ][0 ]['default' ], "production" )
198
+ assert len (question_input ['variables' ]) == 1
199
+ assert question_input ['variables' ][0 ]['name' ] == "environment"
200
+ assert question_input ['variables' ][0 ]['required' ] == True
201
+ assert question_input ['variables' ][0 ]['default' ] == "production"
205
202
206
203
# Check result
207
- self . assertEqual ( len (result ['variables' ]), 1 )
204
+ assert len (result ['variables' ]) == 1
208
205
209
206
@patch ('jupiterone.client.JupiterOneClient._execute_query' )
210
207
def test_create_question_multiple_queries (self , mock_execute ):
@@ -252,12 +249,12 @@ def test_create_question_multiple_queries(self, mock_execute):
252
249
variables = mock_execute .call_args [1 ]['variables' ]
253
250
question_input = variables ['question' ]
254
251
255
- self . assertEqual ( len (question_input ['queries' ]), 2 )
256
- self . assertEqual ( question_input ['queries' ][0 ]['name' ], "Query1" )
257
- self . assertEqual ( question_input ['queries' ][1 ]['name' ], "Query2" )
252
+ assert len (question_input ['queries' ]) == 2
253
+ assert question_input ['queries' ][0 ]['name' ] == "Query1"
254
+ assert question_input ['queries' ][1 ]['name' ] == "Query2"
258
255
259
256
# Check result
260
- self . assertEqual ( len (result ['queries' ]), 2 )
257
+ assert len (result ['queries' ]) == 2
261
258
262
259
def test_create_question_validation_title_required (self ):
263
260
"""Test validation that title is required"""
@@ -321,8 +318,8 @@ def test_create_question_auto_naming(self, mock_execute):
321
318
variables = mock_execute .call_args [1 ]['variables' ]
322
319
question_input = variables ['question' ]
323
320
324
- self . assertEqual ( question_input ['queries' ][0 ]['name' ], "Query0" )
325
- self . assertEqual ( question_input ['queries' ][1 ]['name' ], "Query1" )
321
+ assert question_input ['queries' ][0 ]['name' ] == "Query0"
322
+ assert question_input ['queries' ][1 ]['name' ] == "Query1"
326
323
327
324
@patch ('jupiterone.client.JupiterOneClient._execute_query' )
328
325
def test_create_question_results_are_default (self , mock_execute ):
@@ -348,7 +345,7 @@ def test_create_question_results_are_default(self, mock_execute):
348
345
variables = mock_execute .call_args [1 ]['variables' ]
349
346
question_input = variables ['question' ]
350
347
351
- self . assertEqual ( question_input ['queries' ][0 ]['resultsAre' ], "INFORMATIVE" )
348
+ assert question_input ['queries' ][0 ]['resultsAre' ] == "INFORMATIVE"
352
349
353
350
@patch ('jupiterone.client.JupiterOneClient._execute_query' )
354
351
def test_create_question_version_optional (self , mock_execute ):
@@ -375,7 +372,7 @@ def test_create_question_version_optional(self, mock_execute):
375
372
question_input = variables ['question' ]
376
373
377
374
# Version should not be in the query if not provided
378
- self . assertNotIn ( 'version' , question_input ['queries' ][0 ])
375
+ assert 'version' not in question_input ['queries' ][0 ]
379
376
380
377
# Create question with version
381
378
mock_execute .return_value = {
@@ -398,7 +395,7 @@ def test_create_question_version_optional(self, mock_execute):
398
395
question_input = variables ['question' ]
399
396
400
397
# Version should be included when provided
401
- self . assertEqual ( question_input ['queries' ][0 ]['version' ], "v1" )
398
+ assert question_input ['queries' ][0 ]['version' ] == "v1"
402
399
403
400
@patch ('jupiterone.client.JupiterOneClient._execute_query' )
404
401
def test_create_question_optional_fields_handling (self , mock_execute ):
@@ -428,12 +425,12 @@ def test_create_question_optional_fields_handling(self, mock_execute):
428
425
question_input = variables ['question' ]
429
426
430
427
# None values should not be included
431
- self . assertNotIn ( 'description' , question_input )
432
- self . assertNotIn ( 'tags' , question_input )
428
+ assert 'description' not in question_input
429
+ assert 'tags' not in question_input
433
430
434
431
# Non-None values should be included
435
- self . assertEqual ( question_input ['showTrend' ], False )
436
- self . assertEqual ( question_input ['pollingInterval' ], "ONE_DAY" )
432
+ assert question_input ['showTrend' ] == False
433
+ assert question_input ['pollingInterval' ] == "ONE_DAY"
437
434
438
435
@patch ('jupiterone.client.JupiterOneClient._execute_query' )
439
436
def test_create_question_integration_definition_id (self , mock_execute ):
@@ -460,7 +457,7 @@ def test_create_question_integration_definition_id(self, mock_execute):
460
457
variables = mock_execute .call_args [1 ]['variables' ]
461
458
question_input = variables ['question' ]
462
459
463
- self . assertEqual ( question_input ['integrationDefinitionId' ], "integration-123" )
460
+ assert question_input ['integrationDefinitionId' ] == "integration-123"
464
461
465
462
# Check result
466
- self . assertEqual ( result ['integrationDefinitionId' ], "integration-123" )
463
+ assert result ['integrationDefinitionId' ] == "integration-123"
0 commit comments