This repository has been archived by the owner on May 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use app.get('vhosts') for apps/:id/vhosts
fixes #64
- Loading branch information
Showing
9 changed files
with
139 additions
and
68 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import Ember from 'ember'; | ||
import startApp from '../helpers/start-app'; | ||
import { stubRequest } from '../helpers/fake-server'; | ||
|
||
var App; | ||
|
||
var appId = '1'; | ||
var appUrl = '/apps/' + appId; | ||
var appVhostsUrl = '/apps/' + appId + '/vhosts'; | ||
var appVhostsApiUrl = '/apps/' + appId + '/vhosts'; | ||
var appVhostsNewUrl = '/apps/' + appId + '/vhosts/new'; | ||
|
||
module('Acceptance: App Vhosts', { | ||
setup: function() { | ||
App = startApp(); | ||
}, | ||
teardown: function() { | ||
Ember.run(App, 'destroy'); | ||
} | ||
}); | ||
|
||
test(appVhostsUrl + ' requires authentication', function(){ | ||
expectRequiresAuthentication(appVhostsUrl); | ||
}); | ||
|
||
test('app show page includes link to vhosts url', function(){ | ||
stubApp({ | ||
id: appId | ||
}); | ||
|
||
signInAndVisit(appUrl); | ||
|
||
andThen(function(){ | ||
ok(find('a[href~="' + appVhostsUrl + '"]').length, | ||
'has link to ' + appVhostsUrl); | ||
}); | ||
}); | ||
|
||
test('visit ' + appVhostsUrl + ' has link to ' + appVhostsNewUrl, function(){ | ||
stubApp({ | ||
id: appId | ||
}); | ||
|
||
signInAndVisit(appVhostsUrl); | ||
|
||
andThen(function(){ | ||
ok(find('a[href~="' + appVhostsNewUrl + '"]').length, | ||
'has link to ' + appVhostsNewUrl); | ||
}); | ||
}); | ||
|
||
test('visit ' + appVhostsUrl + ' lists vhosts', function(){ | ||
var vhosts = [{ | ||
id: 1, | ||
virtual_domain: 'www.health1.io', | ||
external_host: 'www.host1.com' | ||
},{ | ||
id: 2, | ||
virtual_domain: 'www.health2.io', | ||
external_host: 'www.host2.com' | ||
}]; | ||
|
||
stubApp({ | ||
id: appId, | ||
_embedded: { | ||
services: [] | ||
}, | ||
_links: { | ||
vhosts: { href: appVhostsApiUrl } | ||
} | ||
}); | ||
|
||
stubRequest('get', appVhostsApiUrl, function(){ | ||
return this.success({ | ||
_embedded: { | ||
vhosts: vhosts | ||
} | ||
}); | ||
}); | ||
|
||
signInAndVisit(appVhostsUrl); | ||
|
||
andThen(function(){ | ||
equal( find('.vhost').length, vhosts.length); | ||
|
||
vhosts.forEach(function(vhost){ | ||
ok( find('.vhost .virtual-domain:contains(' + vhost.virtual_domain + ')').length, | ||
'has virtual domain ' + vhost.virtual_domain ); | ||
|
||
ok( find('.vhost .external-host:contains(' + vhost.external_host + ')').length, | ||
'has external host ' + vhost.external_host ); | ||
}); | ||
}); | ||
}); |
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
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
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