<commit_before>package storage

import (
	"bytes"
	"crypto/rand"
	"encoding/base64"
	"errors"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
	"os"
	"reflect"
	"sort"
	"strings"
	"sync"
	"testing"
	"time"
)

const testContainerPrefix = "zzzztest-"

func TestblobSASStringToSign(t *testing.T) {
	_, err := blobSASStringToSign("2012-02-12", "CS", "SE", "SP")
	if err == nil {
		t.Fatal("Expected error, got nil")
	}

	out, err := blobSASStringToSign("2013-08-15", "CS", "SE", "SP")
	if err != nil {
		t.Fatal(err)
	}
	if expected := "SP\n\nSE\nCS\n\n\n2013-08-15\n%s\n%s\n%s\n%s\n%s"; out != expected {
		t.Errorf("Wrong stringToSign. Expected: '%s', got: '%s'", expected, out)
	}
}

func TestGetBlobSASURI(t *testing.T) {
	api, err := NewClient("foo", "YmFy", DefaultBaseUrl, "2013-08-15", true)
	if err != nil {
		t.Fatal(err)
	}<commit_msg>add tests for pathFor{Container,Blob}() and fix test for blobSASStringToSign<commit_after>package storage

import (
	"bytes"
	"crypto/rand"
	"encoding/base64"
	"errors"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
	"os"
	"reflect"
	"sort"
	"strings"
	"sync"
	"testing"
	"time"
)

const testContainerPrefix = "zzzztest-"

func Test_pathForContainer(t *testing.T) {
	out := pathForContainer("foo")
	if expected := "/foo"; out != expected {
		t.Errorf("Wrong pathForContainer. Expected: '%s', got: '%s'", expected, out)
	}
}

func Test_pathForBlob(t *testing.T) {
	out := pathForBlob("foo", "blob")
	if expected := "/foo/blob"; out != expected {
		t.Errorf("Wrong pathForBlob. Expected: '%s', got: '%s'", expected, out)
	}
}

func Test_blobSASStringToSign(t *testing.T) {
	_, err := blobSASStringToSign("2012-02-12", "CS", "SE", "SP")
	if err == nil {
		t.Fatal("Expected error, got nil")
	}

	out, err := blobSASStringToSign("2013-08-15", "CS", "SE", "SP")
	if err != nil {
		t.Fatal(err)
	}
	if expected := "SP\n\nSE\nCS\n\n2013-08-15\n\n\n\n\n"; out != expected {
		t.Errorf("Wrong stringToSign. Expected: '%s', got: '%s'", expected, out)
	}
}

func TestGetBlobSASURI(t *testing.T) {
	api, err := NewClient("foo", "YmFy", DefaultBaseUrl, "2013-08-15", true)
	if err != nil {
		t.Fatal(err)
	}
{'fraction_non_alphanumeric': 0.20366886171213547, 'fraction_numerical': 0.03198494825964252, 'mean_word_length': 4.162621359223301, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '637552', 'n_tokens_mistral': 971, 'n_tokens_neox': 911, 'n_words': 191}