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
{ | |
"name": "twilio-azure-functions-node", | |
"version": "1.0.0", | |
"description": "Receive SMS and calls with Azure Functions and Node.js", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "Twilio and your-name", | |
"license": "MIT", |
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
// We're using Twilio in this app, and getting ready to send a message response | |
const MessagingResponse = require('twilio').twiml.MessagingResponse; | |
// We're exporting our function from Azure | |
module.exports = function (context) { | |
// Logging what's happening in Azure | |
context.log('JavaScript HTTP trigger function processed a request.'); | |
// Create a new TwiML response | |
const response = new MessagingResponse(); |
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
// Use Twilio in this app | |
const VoiceResponse = require('twilio').twiml.VoiceResponse; | |
// Export the function from Azure | |
module.exports = function (context) { | |
// Log the response in Azure | |
context.log('JavaScript HTTP trigger function processed a request.'); | |
// Create a new TwiML response, this time using voice | |
const twiml = new VoiceResponse(); |
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
class CampaignServiceSpec extends Specification { | |
// fields | |
// fixture methods | |
// feature methods | |
// helper methods | |
} |
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
def setupSpec // runs once - before the first feature method | |
def setup // runs before every feature method | |
def cleanup // runs after every feature method | |
def cleanupSpec // runs once - after the last feature method |
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
package com.testguide | |
import grails.testing.gorm.DomainUnitTest | |
import org.springframework.validation.FieldError | |
import spock.lang.Specification | |
import static com.testguide.StringUtil.newUuid | |
import static com.testguide.test.UnitTestDomainFactory.createDomain | |
class CampaignSpec extends Specification implements DomainUnitTest<Campaign> { |
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
import grails.testing.gorm.DomainUnitTest | |
import spock.lang.Specification | |
class CampaignSpec extends Specification implements DomainUnitTest<Campaign> { | |
} |
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
package com.testguide | |
import com.testguide.CampaignService | |
import com.testguide.User | |
import com.testguide.dataservice.UserDataService | |
import grails.testing.mixin.integration.Integration | |
import grails.web.servlet.mvc.GrailsParameterMap | |
import org.springframework.mock.web.MockHttpServletRequest | |
import org.springframework.test.annotation.Rollback | |
import org.springframework.transaction.annotation.Transactional |
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
def controllerFunction() { | |
def user = User.get(params.userId) | |
if (!userPermissionService.hasPermissionToDoThis(user) { | |
response.status = 403 | |
render "User unauthorized" | |
return | |
} | |
def comments = commentsService.getByUser(user) | |
... | |
OlderNewer