forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'grafana/master' into datalink-on-field
* grafana/master: QueryEditor: check if optional func toggleEditorMode is provided (grafana#18705) Emails: remove the yarn.lock (grafana#18724) OAuth: Support JMES path lookup when retrieving user email (grafana#14683) Emails: resurrect template notification (grafana#18686) Email: add reply-to and direct attachment (grafana#18715)
- Loading branch information
Showing
16 changed files
with
261 additions
and
45 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
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,9 +1,15 @@ | ||
## Prerequisites | ||
|
||
- npm install | ||
- gem install premailer | ||
- grunt (default task will build new inlines email templates) | ||
- grunt watch (will build on source html or css change) | ||
|
||
assembled email templates will be in dist/ and final | ||
inlined templates will be in ../public/emails/ | ||
## Tasks | ||
|
||
- npm run build (default task will build new inlines email templates) | ||
- npm start (will build on source html or css change) | ||
|
||
## Result | ||
|
||
Assembled email templates will be in `dist/` and final | ||
inlined templates will be in `../public/emails/` | ||
|
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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package social | ||
|
||
import ( | ||
"github.com/grafana/grafana/pkg/infra/log" | ||
. "github.com/smartystreets/goconvey/convey" | ||
"testing" | ||
) | ||
|
||
func TestSearchJSONForEmail(t *testing.T) { | ||
Convey("Given a generic OAuth provider", t, func() { | ||
provider := SocialGenericOAuth{ | ||
SocialBase: &SocialBase{ | ||
log: log.New("generic_oauth_test"), | ||
}, | ||
} | ||
|
||
tests := []struct { | ||
Name string | ||
UserInfoJSONResponse []byte | ||
EmailAttributePath string | ||
ExpectedResult string | ||
}{ | ||
{ | ||
Name: "Given an invalid user info JSON response", | ||
UserInfoJSONResponse: []byte("{"), | ||
EmailAttributePath: "attributes.email", | ||
ExpectedResult: "", | ||
}, | ||
{ | ||
Name: "Given an empty user info JSON response and empty JMES path", | ||
UserInfoJSONResponse: []byte{}, | ||
EmailAttributePath: "", | ||
ExpectedResult: "", | ||
}, | ||
{ | ||
Name: "Given an empty user info JSON response and valid JMES path", | ||
UserInfoJSONResponse: []byte{}, | ||
EmailAttributePath: "attributes.email", | ||
ExpectedResult: "", | ||
}, | ||
{ | ||
Name: "Given a simple user info JSON response and valid JMES path", | ||
UserInfoJSONResponse: []byte(`{ | ||
"attributes": { | ||
"email": "grafana@localhost" | ||
} | ||
}`), | ||
EmailAttributePath: "attributes.email", | ||
ExpectedResult: "grafana@localhost", | ||
}, | ||
{ | ||
Name: "Given a user info JSON response with e-mails array and valid JMES path", | ||
UserInfoJSONResponse: []byte(`{ | ||
"attributes": { | ||
"emails": ["grafana@localhost", "admin@localhost"] | ||
} | ||
}`), | ||
EmailAttributePath: "attributes.emails[0]", | ||
ExpectedResult: "grafana@localhost", | ||
}, | ||
{ | ||
Name: "Given a nested user info JSON response and valid JMES path", | ||
UserInfoJSONResponse: []byte(`{ | ||
"identities": [ | ||
{ | ||
"userId": "grafana@localhost" | ||
}, | ||
{ | ||
"userId": "admin@localhost" | ||
} | ||
] | ||
}`), | ||
EmailAttributePath: "identities[0].userId", | ||
ExpectedResult: "grafana@localhost", | ||
}, | ||
} | ||
|
||
for _, test := range tests { | ||
provider.emailAttributePath = test.EmailAttributePath | ||
Convey(test.Name, func() { | ||
actualResult := provider.searchJSONForEmail(test.UserInfoJSONResponse) | ||
So(actualResult, ShouldEqual, test.ExpectedResult) | ||
}) | ||
} | ||
}) | ||
} |
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
Oops, something went wrong.