Example #1
0
func TestAppShowWithAppNotFound(t *testing.T) {
	aws := test.StubAws(
		test.DescribeStackNotFound("convox-test-bar"),
		test.DescribeStackNotFound("bar"),
	)
	defer aws.Close()

	test.AssertStatus(t, 404, "GET", "http://convox/apps/bar", nil)
}
Example #2
0
func TestAppCreateWithAlreadyExistsUnbound(t *testing.T) {
	aws := test.StubAws(
		test.DescribeAppStackCycle("application"),
	)
	defer aws.Close()

	val := url.Values{"name": []string{"application"}}
	body := test.AssertStatus(t, 403, "POST", "http://convox/apps", val)
	assert.Equal(t, "{\"error\":\"there is already a legacy app named application (running). We recommend you delete this app and create it again.\"}", body)
}
Example #3
0
func TestAppCreateWithRackName(t *testing.T) {
	aws := test.StubAws(
		test.DescribeAppStackCycle("foobar"),
	)
	defer aws.Close()

	val := url.Values{"name": []string{"convox-test"}}
	body := test.AssertStatus(t, 403, "POST", "http://convox/apps", val)
	assert.Equal(t, "{\"error\":\"application name cannot match rack name (convox-test). Please choose a different name for your app.\"}", body)
}
Example #4
0
func TestAppCreateWithAlreadyExists(t *testing.T) {
	aws := test.StubAws(
		test.CreateAppStackExistsCycle("application"),
		test.DescribeAppStackCycle("application"),
	)
	defer aws.Close()

	val := url.Values{"name": []string{"application"}}
	test.AssertStatus(t, 403, "POST", "http://convox/apps", val)
}
Example #5
0
func TestAppCreateWithAlreadyExists(t *testing.T) {
	aws := test.StubAws(
		test.DescribeStackNotFound("application"),
		test.CreateAppStackExistsCycle("convox-test-application"),
		test.DescribeAppStackCycle("convox-test-application"),
	)
	defer aws.Close()

	val := url.Values{"name": []string{"application"}}
	body := test.AssertStatus(t, 403, "POST", "http://convox/apps", val)
	assert.Equal(t, "{\"error\":\"there is already an app named application (running)\"}", body)
}
Example #6
0
func TestAppDeleteWithAppNotFound(t *testing.T) {
	aws := test.StubAws(test.DescribeStackNotFound("bar"))
	defer aws.Close()

	test.AssertStatus(t, 404, "DELETE", "http://convox/apps/bar", nil)
}