Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

276 anonymous session #283

Merged
merged 21 commits into from
Aug 22, 2017
Merged

276 anonymous session #283

merged 21 commits into from
Aug 22, 2017

Conversation

hisabimbola
Copy link
Contributor

Summary

Fixes #276

Description

Todo

  • Tests
    • Unit
    • Integration
    • Acceptance
  • Documentation

@hisabimbola
Copy link
Contributor Author

This PR was built from #281, so make sense to review after that PR has been merged.

@hisabimbola hisabimbola force-pushed the 276_anonymous_session branch from a3d20ea to 150e357 Compare August 21, 2017 13:59
@codecov
Copy link

codecov bot commented Aug 21, 2017

Codecov Report

Merging #283 into master will increase coverage by 0.08%.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #283      +/-   ##
========================================
+ Coverage   97.92%    98%   +0.08%     
========================================
  Files          72     72              
  Lines        1590   1605      +15     
  Branches      350    354       +4     
========================================
+ Hits         1557   1573      +16     
+ Misses         27     26       -1     
  Partials        6      6
Impacted Files Coverage Δ
packages/sdk-middleware-auth/src/base-auth-flow.js 100% <ø> (ø) ⬆️
packages/sdk-middleware-auth/src/build-requests.js 100% <100%> (ø) ⬆️
.../sdk-middleware-auth/src/anonymous-session-flow.js 100% <100%> (+100%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 55a504c...42077a6. Read the comment docs.

Copy link
Contributor

@adnasa adnasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some nitpicks

const options = createTestOptions({
credentials: {
clientId: 'yeah',
clientSecret: 'yo',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • clientId: foo
  • clientSecret: bar

const mockCred = {
clientId: '123',
clientSecret: 'secret',
anonymousId: 'youdontknowme',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • clientId: foo
  • clientSecret: bar
  • anonymousId: baz

expect(buildRequestForAnonymousSessionFlow(options)).toEqual({
basicAuth: 'MTIzOnNlY3JldA==',
url: 'http://localhost:8080/oauth/test/anonymous/token',
body: oneLineTrim`grant_type=client_credentials&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use new lines to increase readability here?

)
expect(actualParams.basicAuth).toBe('MTIzOnNlY3JldA==')
expect(authMiddlewareBase).toHaveBeenCalledTimes(1)
jest.unmock('../src/base-auth-flow')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be in an afterEach or afterAll?

Abimbola Idowu added 16 commits August 22, 2017 11:43
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth

ISSUES CLOSED: #212
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
@hisabimbola hisabimbola force-pushed the 276_anonymous_session branch from 150e357 to ed81854 Compare August 22, 2017 10:10

1. `host` *(String)*: the host of the OAuth API service
2. `projectKey` *(String)*: the key of the project to assign the default scope to
3. `credentials` *(Object)*: the client credentials for authentication (`clientId`, `clientSecret`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The customer username and password (the user object) should also be part of the credentials object

@@ -4,6 +4,9 @@ import {

import authMiddlewareBase from '../src/base-auth-flow'

// required to be at the root because Jest hoists it avoid all requires,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean above all requires?

Abimbola Idowu added 3 commits August 22, 2017 12:23
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
Copy link
Contributor

@wizzy25 wizzy25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

affects: @commercetools/sdk-middleware-auth
@wizzy25 wizzy25 merged commit 30a9f0b into master Aug 22, 2017
@wizzy25 wizzy25 deleted the 276_anonymous_session branch August 22, 2017 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants