Ejemplo n.º 1
0
 def test_get_channel_block_again(self):
     mock_pod_ex = Mock()
     mock_pod_ex.execute.side_effect = [
         ("/var/hyperledger/a-channel.block", None)  # Get channel file
     ]
     result = get_channel_block(mock_pod_ex, "ord42", "ord-namespace",
                                "a-channel", "some-suffix")
     mock_pod_ex.execute.assert_has_calls(
         [call("ls /var/hyperledger/a-channel.block")])
     assert result is True
Ejemplo n.º 2
0
 def test_get_channel_block_error(self):
     mock_pod_ex = Mock()
     mock_pod_ex.execute.side_effect = [
         ("", None),  # Get channel file
         ("some logs", "some error"),  # Fetch existing channel
     ]
     result = get_channel_block(mock_pod_ex, "ord42", "ord-namespace",
                                "a-channel", "some-suffix")
     mock_pod_ex.execute.assert_has_calls([
         call("ls /var/hyperledger/a-channel.block"),
         call(
             "bash -c 'peer channel fetch 0 /var/hyperledger/a-channel.block -c a-channel "
             +
             "-o ord42-hlf-ord.ord-namespace.svc.cluster.local:7050 some-suffix'"
         ),
     ])
     assert result is False