forked from cloudfoundry/python-buildpack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbrats_test.go
More file actions
49 lines (45 loc) · 2.13 KB
/
brats_test.go
File metadata and controls
49 lines (45 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package brats_test
import (
"github.com/cloudfoundry/libbuildpack/bratshelper"
"github.com/cloudfoundry/libbuildpack/cutlass"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"golang.org/x/crypto/bcrypt"
)
var _ = Describe("Python buildpack", func() {
bratshelper.UnbuiltBuildpack("python", CopyBrats)
bratshelper.DeployingAnAppWithAnUpdatedVersionOfTheSameBuildpack(CopyBrats)
bratshelper.StagingWithBuildpackThatSetsEOL("python", CopyBrats)
bratshelper.StagingWithADepThatIsNotTheLatest("python", CopyBrats)
bratshelper.StagingWithCustomBuildpackWithCredentialsInDependencies(`python\-[\d\.]+\-linux\-x64\-[\da-f]+\.tgz`, CopyBrats)
bratshelper.DeployAppWithExecutableProfileScript("python", CopyBrats)
bratshelper.DeployAnAppWithSensitiveEnvironmentVariables(CopyBrats)
bratshelper.ForAllSupportedVersions("python", CopyBrats, func(pythonVersion string, app *cutlass.App) {
PushApp(app)
By("runs a simple webserver", func() {
Expect(app.GetBody("/")).To(ContainSubstring("Hello World!"))
})
By("uses the correct python version", func() {
Expect(app.Stdout.String()).To(ContainSubstring("Installing python " + pythonVersion))
Expect(app.GetBody("/version")).To(ContainSubstring(pythonVersion))
})
By("encrypts with bcrypt", func() {
hashedPassword, err := app.GetBody("/bcrypt")
Expect(err).ToNot(HaveOccurred())
Expect(bcrypt.CompareHashAndPassword([]byte(hashedPassword), []byte("Hello, bcrypt"))).ToNot(HaveOccurred())
})
By("supports postgres by raising a no connection error", func() {
Expect(app.GetBody("/pg")).To(ContainSubstring("could not connect to server: No such file or directory"))
})
By("supports mysql by raising a no connection error", func() {
Expect(app.GetBody("/mysql")).To(ContainSubstring("Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock"))
})
By("supports loading and running the hiredis lib", func() {
Expect(app.GetBody("/redis")).To(ContainSubstring("Hello"))
})
By("supports the proper version of unicode", func() {
maxUnicode := "1114111"
Expect(app.GetBody("/unicode")).To(ContainSubstring("max unicode: " + maxUnicode))
})
})
})