@@ -27,17 +27,46 @@ def test_event_grid_output_valid_creation(self):
27
27
output = EventGridOutput (name = "res" ,
28
28
topic_endpoint_uri = "dummy_topic_endpoint_uri" ,
29
29
topic_key_setting = "dummy_topic_key_setting" ,
30
- connection = "dummy_connection" ,
31
30
data_type = DataType .UNDEFINED ,
32
31
dummy_field = "dummy" )
33
32
34
33
self .assertEqual (output .get_binding_name (), "eventGrid" )
35
34
self .assertEqual (output .get_dict_repr (),
36
- {'connection' : 'dummy_connection' ,
37
- 'dataType' : DataType .UNDEFINED ,
38
- 'direction' : BindingDirection .OUT ,
39
- 'dummyField' : 'dummy' ,
40
- 'topicEndpointUri' : 'dummy_topic_endpoint_uri' ,
41
- 'topicKeySetting' : 'dummy_topic_key_setting' ,
42
- 'name' : 'res' ,
43
- 'type' : EVENT_GRID })
35
+ {'dataType' : DataType .UNDEFINED ,
36
+ 'direction' : BindingDirection .OUT ,
37
+ 'dummyField' : 'dummy' ,
38
+ 'topicEndpointUri' : 'dummy_topic_endpoint_uri' ,
39
+ 'topicKeySetting' : 'dummy_topic_key_setting' ,
40
+ 'name' : 'res' ,
41
+ 'type' : EVENT_GRID })
42
+
43
+ def test_event_grid_output_valid_creation_with_connection (self ):
44
+ output = EventGridOutput (name = "res" ,
45
+ connection = "dummy_connection" ,
46
+ data_type = DataType .UNDEFINED ,
47
+ dummy_field = "dummy" )
48
+
49
+ self .assertEqual (output .connection , "dummy_connection" )
50
+ self .assertIsNone (output .topic_endpoint_uri )
51
+ self .assertIsNone (output .topic_key_setting )
52
+
53
+ def test_event_grid_output_invalid_creation_with_both (self ):
54
+ with self .assertRaises (ValueError ) as context :
55
+ EventGridOutput (name = "res" ,
56
+ connection = "dummy_connection" ,
57
+ topic_endpoint_uri = "dummy_topic_endpoint_uri" ,
58
+ topic_key_setting = "dummy_topic_key_setting" )
59
+
60
+ self .assertTrue ("Specify either the 'Connection' property or both "
61
+ "'TopicKeySetting' and 'TopicEndpointUri' properties, "
62
+ "but not both." in str (context .exception ))
63
+
64
+ def test_event_grid_output_invalid_creation_with_none (self ):
65
+ with self .assertRaises (ValueError ) as context :
66
+ EventGridOutput (name = "res" ,
67
+ data_type = DataType .UNDEFINED ,
68
+ dummy_field = "dummy" )
69
+
70
+ self .assertTrue ("Specify either the 'Connection' property or both "
71
+ "'TopicKeySetting' and 'TopicEndpointUri' properties,"
72
+ " but not both." in str (context .exception ))
0 commit comments