33
44sys .path .append (os .path .abspath ("../" ))
55
6- from unittest import TestCase
6+ from unittest import TestCase , mock
77from icon_cisco_umbrella_destinations .connection .connection import Connection
8- from icon_cisco_umbrella_destinations .actions .dlCreate import DlCreate
8+ from ..icon_cisco_umbrella_destinations .actions .dlCreate import DlCreate
9+ from icon_cisco_umbrella_destinations .actions .dlCreate .schema import Input
910import json
1011import logging
12+ from unit_test .mock import STUB_CONNECTION , mock_request_200 , STUB_DESTINATION_LIST_ID
1113
1214
1315class TestDlCreate (TestCase ):
14- def test_dlCreate (self ):
15- """
16- DO NOT USE PRODUCTION/SENSITIVE DATA FOR UNIT TESTS
17-
18- TODO: Implement test cases here
19-
20- For information on mocking and unit testing please go here:
21-
22- https://docs.google.com/document/d/1PifePDG1-mBcmNYE8dULwGxJimiRBrax5BIDG_0TFQI/edit?usp=sharing
23- """
24-
25- self .fail ("Unimplemented Test Case" )
16+ def setUp (self ) -> None :
17+ self .connection = Connection ()
18+ self .connection .logger = logging .getLogger ("Connection logger" )
19+ self .connection .connect (STUB_CONNECTION )
20+
21+ self .action = DlCreate ()
22+ self .action .connection = self .connection
23+ self .action .logger = logging .getLogger ("Action logger" )
24+
25+ self .data = {
26+ "access" : "allow" ,
27+ "isGlobal" : True ,
28+ "name" : "NewName" ,
29+ }
30+
31+ @mock .patch ("requests.request" , side_effect = mock_request_200 )
32+ def test_successful (self , mock_post ):
33+ response = self .action .run ()
34+ expected_response = []
0 commit comments