예제 #1
0
 def test_check_id_again(self, mock_get_pod, mock_sleep):
     mock_executor = Mock()
     mock_get_pod.side_effect = [mock_executor]
     mock_executor.execute.side_effect = [("an-ord", None)
                                          ]  # List identities
     check_id("a-namespace", "a-ca", "an-ord")
     mock_get_pod.assert_called_once_with(namespace="a-namespace",
                                          release="a-ca",
                                          app="hlf-ca")
     mock_executor.execute.assert_called_once_with(
         "fabric-ca-client identity list --id an-ord")
     mock_sleep.assert_not_called()
예제 #2
0
 def test_check_id_admin(self, mock_get_pod, mock_sleep):
     mock_executor = Mock()
     mock_get_pod.side_effect = [mock_executor]
     mock_executor.execute.side_effect = [
         (None, "no rows in result set")  # List identities
     ]
     check_id("a-namespace", "a-ca", "an-admin")
     mock_get_pod.assert_called_once_with(namespace="a-namespace",
                                          release="a-ca",
                                          app="hlf-ca")
     mock_executor.execute.assert_called_once_with(
         "fabric-ca-client identity list --id an-admin")
     mock_sleep.assert_not_called()
예제 #3
0
 def test_check_id_serverconnection(self, mock_get_pod, mock_sleep):
     mock_executor = Mock()
     mock_get_pod.side_effect = [mock_executor]
     mock_executor.execute.side_effect = [
         (None, "could not connect to server"),  # List identities
         (None, "no rows in result set"),  # List identities
     ]
     check_id("a-namespace", "a-ca", "an-ord")
     mock_get_pod.assert_called_once_with(namespace="a-namespace",
                                          release="a-ca",
                                          app="hlf-ca")
     mock_executor.execute.assert_has_calls([
         call("fabric-ca-client identity list --id an-ord"),
         call("fabric-ca-client identity list --id an-ord"),
     ])
     mock_sleep.assert_called_once_with(15)