-
-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
214 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Changelog | ||
|
||
Notable changes to Mailpit will be documented in this file. | ||
|
||
|
||
{{ if .Versions -}} | ||
{{ if .Unreleased.CommitGroups -}} | ||
## [Unreleased] | ||
|
||
{{ if .Unreleased.CommitGroups -}} | ||
{{ range .Unreleased.CommitGroups -}} | ||
### {{ .Title }} | ||
{{ range .Commits -}} | ||
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} | ||
{{ end }} | ||
{{ end }} | ||
{{ end -}} | ||
{{ end -}} | ||
{{ end -}} | ||
|
||
{{ range .Versions }} | ||
{{- if .CommitGroups -}} | ||
## {{ .Tag.Name }} | ||
|
||
{{ range .CommitGroups -}} | ||
### {{ .Title }} | ||
{{ range .Commits -}} | ||
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} | ||
{{ end }} | ||
{{ end }} | ||
{{ end -}} | ||
|
||
{{- if .MergeCommits -}} | ||
### Pull Requests | ||
{{ range .MergeCommits -}} | ||
- {{ .Header }} | ||
{{ end }} | ||
{{ end -}} | ||
|
||
{{- if .NoteGroups -}} | ||
{{ range .NoteGroups -}} | ||
### {{ .Title }} | ||
{{ range .Notes }} | ||
{{ .Body }} | ||
{{ end }} | ||
{{ end -}} | ||
{{ end -}} | ||
{{ end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{{ if .Versions -}} | ||
{{ range .Versions }} | ||
{{- if .CommitGroups -}} | ||
{{ range .CommitGroups -}} | ||
### {{ .Title }} | ||
{{ range .Commits -}} | ||
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} | ||
{{ end }} | ||
{{ end -}} | ||
{{ end -}} | ||
{{ end -}} | ||
{{ end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
style: github | ||
template: CHANGELOG.tpl.md | ||
info: | ||
title: CHANGELOG | ||
repository_url: https://github.com/axllent/mailpit | ||
options: | ||
commits: | ||
# filters: | ||
# Type: | ||
# - feat | ||
# - fix | ||
# - perf | ||
# - refactor | ||
commit_groups: | ||
title_maps: | ||
feature: Feature | ||
fix: Fix | ||
# perf: Performance Improvements | ||
# refactor: Code Refactoring | ||
header: | ||
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$" | ||
pattern_maps: | ||
- Type | ||
- Scope | ||
- Subject | ||
notes: | ||
keywords: | ||
- BREAKING CHANGE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,34 @@ | ||
# Changelog | ||
|
||
## [0.0.3] | ||
Notable changes to Mailpit will be documented in this file. | ||
|
||
- Bugfix: Update to clover-v2.0.0-alpha.2 to fix sorting | ||
|
||
## 0.0.4 | ||
|
||
## [0.0.2] | ||
### Bugfix | ||
- Update to clover-v2.0.0-alpha.2 to fix sorting | ||
|
||
- Unread message statistics & updates | ||
### Tests | ||
- Add search tests | ||
|
||
### UI | ||
- Add date to console log | ||
- Add space in To fields | ||
- Cater for messages without From email address | ||
- Minor UI & logging changes | ||
- Add space in To fields | ||
- cater for messages without From email address | ||
|
||
|
||
## 0.0.3 | ||
|
||
### Bugfix | ||
- Update to clover-v2.0.0-alpha.2 to fix sorting | ||
|
||
|
||
## 0.0.2 | ||
|
||
### Feature | ||
- Unread statistics | ||
|
||
## [0.0.1-beta] | ||
|
||
- First release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
package storage | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
"io/ioutil" | ||
"math/rand" | ||
"testing" | ||
"time" | ||
|
||
"github.com/axllent/mailpit/config" | ||
"github.com/jhillyerd/enmime" | ||
) | ||
|
||
var ( | ||
|
@@ -123,6 +126,78 @@ func TestRetrieveMimeEmail(t *testing.T) { | |
assertEqual(t, len(attachmentData.Content), msg.Attachments[0].Size, "attachment size does not match") | ||
inlineData, err := GetAttachmentPart(DefaultMailbox, id, msg.Inline[0].PartID) | ||
assertEqual(t, len(inlineData.Content), msg.Inline[0].Size, "inline attachment size does not match") | ||
|
||
db.Close() | ||
} | ||
|
||
func TestSearch(t *testing.T) { | ||
setup() | ||
|
||
for i := 0; i < 1000; i++ { | ||
msg := enmime.Builder(). | ||
From(fmt.Sprintf("From %d", i), fmt.Sprintf("from-%[email protected]", i)). | ||
Subject(fmt.Sprintf("Subject line %d end", i)). | ||
Text([]byte(fmt.Sprintf("This is the email body %d <jdsauk;dwqmdqw;>.", i))). | ||
To(fmt.Sprintf("To %d", i), fmt.Sprintf("to-%[email protected]", i)) | ||
|
||
env, err := msg.Build() | ||
if err != nil { | ||
t.Log("error ", err) | ||
t.Fail() | ||
} | ||
|
||
buf := new(bytes.Buffer) | ||
|
||
if err := env.Encode(buf); err != nil { | ||
t.Log("error ", err) | ||
t.Fail() | ||
} | ||
|
||
if _, err := Store(DefaultMailbox, buf.Bytes()); err != nil { | ||
t.Log("error ", err) | ||
t.Fail() | ||
} | ||
} | ||
|
||
for i := 1; i < 101; i++ { | ||
// search a random something that will return a single result | ||
searchIndx := rand.Intn(4) + 1 | ||
var search string | ||
switch searchIndx { | ||
case 1: | ||
search = fmt.Sprintf("from-%[email protected]", i) | ||
case 2: | ||
search = fmt.Sprintf("to-%[email protected]", i) | ||
case 3: | ||
search = fmt.Sprintf("Subject line %d end", i) | ||
default: | ||
search = fmt.Sprintf("the email body %d jdsauk dwqmdqw", i) | ||
} | ||
|
||
summaries, err := Search(DefaultMailbox, search, 0, 200) | ||
if err != nil { | ||
t.Log("error ", err) | ||
t.Fail() | ||
} | ||
|
||
assertEqual(t, len(summaries), 1, "1 search result expected") | ||
|
||
assertEqual(t, summaries[0].From.Name, fmt.Sprintf("From %d", i), "\"From\" name does not match") | ||
assertEqual(t, summaries[0].From.Address, fmt.Sprintf("from-%[email protected]", i), "\"From\" address does not match") | ||
assertEqual(t, summaries[0].To[0].Name, fmt.Sprintf("To %d", i), "\"To\" name does not match") | ||
assertEqual(t, summaries[0].To[0].Address, fmt.Sprintf("to-%[email protected]", i), "\"To\" address does not match") | ||
assertEqual(t, summaries[0].Subject, fmt.Sprintf("Subject line %d end", i), "\"Subject\" does not match") | ||
} | ||
|
||
// search something that will return 200 rsults | ||
summaries, err := Search(DefaultMailbox, "This is the email body", 0, 200) | ||
if err != nil { | ||
t.Log("error ", err) | ||
t.Fail() | ||
} | ||
assertEqual(t, len(summaries), 200, "200 search results expected") | ||
|
||
db.Close() | ||
} | ||
|
||
func BenchmarkImportText(b *testing.B) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters