Add site origin data to course trial requests

This commit is contained in:
Matt Lott 2016-04-07 12:13:48 -07:00
parent 29cd880480
commit 5661a1fd8c
6 changed files with 7 additions and 0 deletions

View file

@ -85,6 +85,7 @@ module.exports = class ConvertToTeacherAccountView extends RootView
if error
forms.scrollToFirstError()
return
attrs['siteOrigin'] = 'convert teacher'
@trialRequest = new TrialRequest({
type: 'course'
properties: attrs

View file

@ -105,6 +105,7 @@ module.exports = class CreateTeacherAccountView extends RootView
if error
forms.scrollToFirstError()
return
trialRequestAttrs['siteOrigin'] = 'create teacher'
@trialRequest = new TrialRequest({
type: 'course'
properties: trialRequestAttrs

View file

@ -90,6 +90,7 @@ module.exports = class RequestQuoteView extends RootView
if error
forms.scrollToFirstError()
return
attrs['siteOrigin'] = 'demo request'
@trialRequest = new TrialRequest({
type: 'course'
properties: attrs

View file

@ -135,6 +135,7 @@ describe 'ConvertToTeacherAccountView (/teachers/update-account)', ->
expect(request.method).toBe('POST')
attrs = JSON.parse(request.params)
expect(attrs.properties?.firstName).toBe('Mr')
expect(attrs.properties?.siteOrigin).toBe('convert teacher')
it 'redirects to /teachers/classes', ->
request = jasmine.Ajax.requests.mostRecent()

View file

@ -206,6 +206,7 @@ describe 'CreateTeacherAccountView', ->
expect(attrs.password1).toBeUndefined()
expect(attrs.password2).toBeUndefined()
expect(attrs.name).toBeUndefined()
expect(attrs.properties?.siteOrigin).toBe('create teacher')
describe 'after saving the new trial request', ->
beforeEach ->

View file

@ -122,6 +122,8 @@ describe 'RequestQuoteView', ->
it 'creates a new trial request', ->
expect(@submitRequest).toBeTruthy()
expect(@submitRequest.method).toBe('POST')
attrs = JSON.parse(@submitRequest.params)
expect(attrs.properties?.siteOrigin).toBe('demo request')
it 'sets the user\'s role to the one they chose', ->
request = _.last(jasmine.Ajax.requests.filter((r) -> _.string.startsWith(r.url, '/db/user')))