-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed the testcases for the feedback
- Loading branch information
1 parent
5fa5c8e
commit 855f968
Showing
4 changed files
with
14 additions
and
14 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
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 |
---|---|---|
|
@@ -58,10 +58,10 @@ func messageWithHeaders(feedback *model.Feedback) *gomail.Message { | |
// From | ||
m.SetAddressHeader("From", os.Getenv("SMTP_USERNAME"), "TUM Campus App") | ||
// To | ||
if feedback.Recipient.Valid { | ||
m.SetHeader("To", feedback.Recipient.String) | ||
if feedback.Recipient != "" { | ||
m.SetHeader("To", feedback.Recipient) | ||
} else { | ||
m.SetHeader("To", "[email protected]") | ||
m.SetHeader("To", "[email protected]") // should not ever happen as checked in the api | ||
} | ||
// ReplyTo | ||
if feedback.ReplyTo.Valid { | ||
|
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 |
---|---|---|
|
@@ -23,10 +23,10 @@ func TestIterate(t *testing.T) { | |
|
||
func fullFeedback() *model.Feedback { | ||
return &model.Feedback{ | ||
EmailId: null.StringFrom("magic-id"), | ||
Recipient: null.StringFrom("tca"), | ||
EmailId: "magic-id", | ||
Recipient: "tca", | ||
ReplyTo: null.StringFrom("[email protected]"), | ||
Feedback: null.StringFrom("This is a Test"), | ||
Feedback: "This is a Test", | ||
ImageCount: 1, | ||
Latitude: null.FloatFrom(0), | ||
Longitude: null.FloatFrom(0), | ||
|
@@ -38,10 +38,10 @@ func fullFeedback() *model.Feedback { | |
|
||
func emptyFeedback() *model.Feedback { | ||
return &model.Feedback{ | ||
EmailId: null.String{}, | ||
Recipient: null.String{}, | ||
EmailId: "", | ||
Recipient: "", | ||
ReplyTo: null.String{}, | ||
Feedback: null.String{}, | ||
Feedback: "", | ||
ImageCount: 0, | ||
Latitude: null.Float{}, | ||
Longitude: null.Float{}, | ||
|
@@ -56,7 +56,7 @@ func TestHeaderInstantiationWithFullFeedback(t *testing.T) { | |
fb := fullFeedback() | ||
m := messageWithHeaders(fb) | ||
assert.Equal(t, []string{`"TUM Campus App" <[email protected]>`}, m.GetHeader("From")) | ||
assert.Equal(t, []string{fb.Recipient.String}, m.GetHeader("To")) | ||
assert.Equal(t, []string{fb.Recipient}, m.GetHeader("To")) | ||
assert.Equal(t, []string{"[email protected]"}, m.GetHeader("Reply-To")) | ||
assert.Equal(t, []string{fb.Timestamp.Time.Format(time.RFC1123Z)}, m.GetHeader("Date")) | ||
assert.Equal(t, []string{"Feedback via Tum Campus App"}, m.GetHeader("Subject")) | ||
|