From 3d75a4a281041a91112c811078e4daf5b0f3e84d Mon Sep 17 00:00:00 2001 From: Lakhan Samani Date: Mon, 10 Jan 2022 10:45:20 +0530 Subject: [PATCH 1/4] Fix bug getting github login meta data --- server/utils/meta.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/utils/meta.go b/server/utils/meta.go index e7c2e6e..9df8022 100644 --- a/server/utils/meta.go +++ b/server/utils/meta.go @@ -11,7 +11,7 @@ func GetMetaInfo() model.Meta { return model.Meta{ Version: constants.VERSION, IsGoogleLoginEnabled: constants.GOOGLE_CLIENT_ID != "" && constants.GOOGLE_CLIENT_SECRET != "", - IsGithubLoginEnabled: constants.GITHUB_CLIENT_ID != "" && constants.GOOGLE_CLIENT_SECRET != "", + IsGithubLoginEnabled: constants.GITHUB_CLIENT_ID != "" && constants.GITHUB_CLIENT_SECRET != "", IsFacebookLoginEnabled: constants.FACEBOOK_CLIENT_ID != "" && constants.FACEBOOK_CLIENT_SECRET != "", IsBasicAuthenticationEnabled: !constants.DISABLE_BASIC_AUTHENTICATION, IsEmailVerificationEnabled: !constants.DISABLE_EMAIL_VERIFICATION, From f5aeda12837ff3d8661d3857b3a09091279cb103 Mon Sep 17 00:00:00 2001 From: Lakhan Samani Date: Tue, 11 Jan 2022 19:38:20 +0530 Subject: [PATCH 2/4] Update arangodb test connection string --- server/__test__/resolvers_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/__test__/resolvers_test.go b/server/__test__/resolvers_test.go index 160265c..7eb73d5 100644 --- a/server/__test__/resolvers_test.go +++ b/server/__test__/resolvers_test.go @@ -11,7 +11,7 @@ import ( func TestResolvers(t *testing.T) { databases := map[string]string{ enum.Sqlite.String(): "../../data.db", - enum.Arangodb.String(): "http://root:root@localhost:8529", + enum.Arangodb.String(): "http://localhost:8529", enum.Mongodb.String(): "mongodb://localhost:27017", } From 75affcbf30bc35f61c2fe04422a6d635778f1f8e Mon Sep 17 00:00:00 2001 From: Lakhan Samani Date: Tue, 11 Jan 2022 19:38:58 +0530 Subject: [PATCH 3/4] Update contributing test doc --- .github/CONTRIBUTING.md | 233 +++++++++++++++++++--------------------- 1 file changed, 111 insertions(+), 122 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 21346cf..cfffb46 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -60,181 +60,170 @@ Setup mongodb & arangodb using Docker ``` docker run --name mongodb -d -p 27017:27017 mongo -docker run --name arangodb -d -p 8529:8529 -e ARANGO_ROOT_PASSWORD=root arangodb/arangodb:3.8.4 + +// -e ARANGO_ROOT_PASSWORD=root +docker run --name arangodb -d -p 8529:8529 arangodb/arangodb:3.8.4 ``` + > Note: If you are not making any changes in db schema / db operations, you can disable those db tests [here](https://github.com/authorizerdev/authorizer/blob/main/server/__test__/resolvers_test.go#L14) -If you are adding new resolver, +If you are adding new resolver, + 1. create new resolver test file [here](https://github.com/authorizerdev/authorizer/tree/main/server/__test__) -Naming convention filename: `resolver_name_test.go` function name: `resolverNameTest(s TestSetup, t *testing.T)` + Naming convention filename: `resolver_name_test.go` function name: `resolverNameTest(s TestSetup, t *testing.T)` 2. Add your tests [here](https://github.com/authorizerdev/authorizer/blob/main/server/__test__/resolvers_test.go#L38) -__Command to run tests:__ +**Command to run tests:** ```sh make test ``` -__Manual Testing:__ +**Manual Testing:** For manually testing using graphql playground, you can paste following queries and mutations in your playground and test it ```gql mutation Signup { - signup(params: { - email: "lakhan@yopmail.com", - password: "test", - confirm_password: "test", - given_name: "lakhan" - }) { - message - user { - id - family_name - given_name - email - email_verified - } - } + signup( + params: { + email: "lakhan@yopmail.com" + password: "test" + confirm_password: "test" + given_name: "lakhan" + } + ) { + message + user { + id + family_name + given_name + email + email_verified + } + } } mutation ResendEamil { - resend_verify_email(params: { - email: "lakhan@yopmail.com" - identifier: "basic_auth_signup" - }) { - message - } + resend_verify_email( + params: { email: "lakhan@yopmail.com", identifier: "basic_auth_signup" } + ) { + message + } } query GetVerifyRequests { - _verification_requests { - id - token - expires - identifier - } + _verification_requests { + id + token + expires + identifier + } } mutation VerifyEmail { - verify_email(params: { - token: "" - }) { - access_token - expires_at - user { - id - email - given_name - email_verified - } - } + verify_email(params: { token: "" }) { + access_token + expires_at + user { + id + email + given_name + email_verified + } + } } mutation Login { - login(params: { - email: "lakhan@yopmail.com", - password: "test" - }) { - access_token - expires_at - user { - id - family_name - given_name - email - } - } + login(params: { email: "lakhan@yopmail.com", password: "test" }) { + access_token + expires_at + user { + id + family_name + given_name + email + } + } } query GetSession { - session { - access_token - expires_at - user { - id - given_name - family_name - email - email_verified - signup_methods - created_at - updated_at - } - } + session { + access_token + expires_at + user { + id + given_name + family_name + email + email_verified + signup_methods + created_at + updated_at + } + } } mutation ForgotPassword { - forgot_password(params: { - email: "lakhan@yopmail.com" - }) { - message - } + forgot_password(params: { email: "lakhan@yopmail.com" }) { + message + } } mutation ResetPassword { - reset_password(params: { - token: "" - password: "test" - confirm_password: "test" - }) { - message - } + reset_password( + params: { token: "", password: "test", confirm_password: "test" } + ) { + message + } } mutation UpdateProfile { - update_profile(params: { - family_name: "samani" - }) { - message - } + update_profile(params: { family_name: "samani" }) { + message + } } query GetUsers { - _users { - id - email - email_verified - given_name - family_name - picture - signup_methods - phone_number - } + _users { + id + email + email_verified + given_name + family_name + picture + signup_methods + phone_number + } } mutation MagicLinkLogin { - magic_link_login(params: { - email: "test@yopmail.com" - }) { - message - } + magic_link_login(params: { email: "test@yopmail.com" }) { + message + } } mutation Logout { - logout { - message - } + logout { + message + } } -mutation UpdateUser{ - _update_user(params: { - id: "dafc9400-d603-4ade-997c-83fcd54bbd67", - roles: ["user", "admin"] - }) { - email - roles - } +mutation UpdateUser { + _update_user( + params: { + id: "dafc9400-d603-4ade-997c-83fcd54bbd67" + roles: ["user", "admin"] + } + ) { + email + roles + } } mutation DeleteUser { - _delete_user(params: { - email: "signup.test134523@yopmail.com" - }) { - message - } + _delete_user(params: { email: "signup.test134523@yopmail.com" }) { + message + } } ``` - - - From 9363d83945ee8b6a8836ce9a40715736224c7b39 Mon Sep 17 00:00:00 2001 From: Lakhan Samani Date: Tue, 11 Jan 2022 19:39:57 +0530 Subject: [PATCH 4/4] Update contributing test doc --- .github/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index cfffb46..5c6b814 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -62,7 +62,7 @@ Setup mongodb & arangodb using Docker docker run --name mongodb -d -p 27017:27017 mongo // -e ARANGO_ROOT_PASSWORD=root -docker run --name arangodb -d -p 8529:8529 arangodb/arangodb:3.8.4 +docker run --name arangodb -d -p 8529:8529 -e ARANGO_NO_AUTH=1 arangodb/arangodb:3.8.4 ``` > Note: If you are not making any changes in db schema / db operations, you can disable those db tests [here](https://github.com/authorizerdev/authorizer/blob/main/server/__test__/resolvers_test.go#L14)