Azure-Storage-Blob-Client

 view release on metacpan or  search on metacpan

t/Azure/Storage/Blob/Client/Caller.t  view on Meta::CPAN

        blob_name => 'myblob',
      );
    };

    When 'the caller receives a BlobNotFound error from the API' => sub {
      $signer_mock
        ->expects('calculate_signature');
      $ua_mock
        ->expects('request')
        ->returns(HTTP::Response->new(
            404,
            'The specified blob does not exist.',
            HTTP::Headers->new('x-ms-error-code' => 'BlobNotFound'),
          )
        );
      trap { $caller->request($account_name, $account_key, $call_object) };
      $error = $trap->die;
    };

    Then 'it should throw a BlobNotFound exception' => sub {
      like($error->code, qr/BlobNotFound/);

t/Azure/Storage/Blob/Client/Caller.t  view on Meta::CPAN

        blob_name => 'myblob',
      );
    };

    When 'the caller receives a ContainerNotFound error from the API' => sub {
      $signer_mock
        ->expects('calculate_signature');
      $ua_mock
        ->expects('request')
        ->returns(HTTP::Response->new(
            404,
            'The specified container does not exist.',
            HTTP::Headers->new('x-ms-error-code' => 'ContainerNotFound'),
          )
        );
      trap { $caller->request($account_name, $account_key, $call_object) };
      $error = $trap->die;
    };

    Then 'it should throw a ContainerNotFound exception' => sub {
      like($error->code, qr/ContainerNotFound/);

t/Azure/Storage/Blob/Client/Caller.t  view on Meta::CPAN

        blob_name => 'myblob',
      );
    };

    When 'the caller receives a InvalidBlobType error from the API' => sub {
      $signer_mock
        ->expects('calculate_signature');
      $ua_mock
        ->expects('request')
        ->returns(HTTP::Response->new(
            404,
            'The specified container does not exist.',
            HTTP::Headers->new('x-ms-error-code' => 'InvalidBlobType'),
          )
        );
      trap { $caller->request($account_name, $account_key, $call_object) };
      $error = $trap->die;
    };

    Then 'it should throw a InvalidBlobType exception' => sub {
      like($error->code, qr/InvalidBlobType/);

t/Azure/Storage/Blob/Client/Caller.t  view on Meta::CPAN

        blob_name => 'myblob',
      );
    };

    When 'the caller receives an unknown error from the Azure Storage API' => sub {
      $signer_mock
        ->expects('calculate_signature');
      $ua_mock
        ->expects('request')
        ->returns(HTTP::Response->new(
            404,
            'The specified blob does not exist.',
            HTTP::Headers->new('x-ms-error-code' => undef),
          )
        );
      trap { $caller->request($account_name, $account_key, $call_object) };
      $error = $trap->die;
    };

    Then 'it should throw an UknownAzureStorageAPIError exception' => sub {
      like($error->code, qr/UnknownAzureStorageAPIError/);



( run in 1.460 second using v1.01-cache-2.11-cpan-39bf76dae61 )