@@ -19,6 +19,19 @@ def test_cml_start(self):
19
19
self .assertEqual (0 , result .exit_code )
20
20
self .assertNotIn ("Node rtr-2 is already active" , result .output )
21
21
22
+ def test_cml_start_by_id (self ):
23
+ with self .get_context () as m :
24
+ # Mock the request to return what we expect from the API.
25
+ self .setup_func ("get" , m , "labs/{}/nodes/n2/check_if_converged" .format (self .get_test_id ()), json = True )
26
+ self .setup_func ("put" , m , "labs/{}/nodes/n2/state/start" .format (self .get_test_id ()), json = None )
27
+ self .setup_func ("get" , m , "labs/{}/nodes/n2/check_if_converged" .format (self .get_test_id ()), json = True )
28
+ self .setup_mocks (m )
29
+ virl = self .get_virl ()
30
+ runner = CliRunner ()
31
+ result = runner .invoke (virl , ["start" , "--id" ], "88119b68-9d08-40c4-90f5-6dc533fd0257" )
32
+ self .assertEqual (0 , result .exit_code )
33
+ self .assertNotIn ("Node rtr-2 is already active" , result .output )
34
+
22
35
def test_cml_start_already_active (self ):
23
36
with self .get_context () as m :
24
37
# Mock the request to return what we expect from the API.
@@ -29,6 +42,26 @@ def test_cml_start_already_active(self):
29
42
self .assertEqual (0 , result .exit_code )
30
43
self .assertIn ("Node rtr-1 is already active" , result .output )
31
44
45
+ def test_cml_start_already_active_by_id (self ):
46
+ with self .get_context () as m :
47
+ # Mock the request to return what we expect from the API.
48
+ self .setup_mocks (m )
49
+ virl = self .get_virl ()
50
+ runner = CliRunner ()
51
+ result = runner .invoke (virl , ["start" , "--id" , "88119b68-9d08-40c4-90f5-6dc533fd0256" ])
52
+ self .assertEqual (0 , result .exit_code )
53
+ self .assertIn ("Node rtr-1 is already active" , result .output )
54
+
55
+ def test_cml_start_missing_args (self ):
56
+ with self .get_context () as m :
57
+ # Mock the request to return what we expect from the API.
58
+ self .setup_mocks (m )
59
+ virl = self .get_virl ()
60
+ runner = CliRunner ()
61
+ result = runner .invoke (virl , ["start" ])
62
+ self .assertEqual (1 , result .exit_code )
63
+ self .assertIn ("Usage: cml start" , result .output )
64
+
32
65
def test_cml_start_bogus_node (self ):
33
66
with self .get_context () as m :
34
67
# Mock the request to return what we expect from the API.
0 commit comments