<commit_before>package blaze

import (
	"bytes"
	"mime/multipart"
	"net/http"
	"net/http/httptest"
	"net/textproto"
	"strings"
	"testing"
	"time"

	"github.com/stretchr/testify/assert"

	"github.com/256dpi/fire"
	"github.com/256dpi/fire/coal"
	"github.com/256dpi/fire/heat"
)

func TestStorageUploadInvalidContentType(t *testing.T) {
	withTester(t, func(t *testing.T, tester *fire.Tester) {
		storage := NewStorage(tester.Store, testNotary, NewMemory())
<commit_msg>added test<commit_after>package blaze

import (
	"bytes"
	"mime/multipart"
	"net/http"
	"net/http/httptest"
	"net/textproto"
	"strings"
	"testing"
	"time"

	"github.com/stretchr/testify/assert"

	"github.com/256dpi/fire"
	"github.com/256dpi/fire/coal"
	"github.com/256dpi/fire/heat"
)

func TestStorageUpload(t *testing.T) {
	withTester(t, func(t *testing.T, tester *fire.Tester) {
		service := NewMemory()
		storage := NewStorage(tester.Store, testNotary, service)

		body := strings.NewReader("Hello World!")
		key, err := storage.Upload(nil, "application/octet-stream", 12, body)
		assert.NoError(t, err)
		assert.NotEmpty(t, key)
		assert.Equal(t, map[string]*Blob{
			"1": {
				Type:  "application/octet-stream",
				Bytes: []byte("Hello World!"),
			},
		}, service.Blobs)

		files := *tester.FindAll(&File{}).(*[]*File)
		assert.Len(t, files, 1)
		assert.Equal(t, Uploaded, files[0].State)
		assert.Equal(t, "application/octet-stream", files[0].Type)
		assert.Equal(t, int64(12), files[0].Length)
		assert.Equal(t, Handle{"id": "1"}, files[0].Handle)
	})
}

func TestStorageUploadInvalidContentType(t *testing.T) {
	withTester(t, func(t *testing.T, tester *fire.Tester) {
		storage := NewStorage(tester.Store, testNotary, NewMemory())

{'fraction_non_alphanumeric': 0.1767115272088941, 'fraction_numerical': 0.018139262726740785, 'mean_word_length': 4.836177474402731, 'pattern_counts': {'":': 2, '<': 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': '6920220', 'n_tokens_mistral': 733, 'n_tokens_neox': 676, 'n_words': 109}