1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 20:35:25 +02:00

Whitespace diff, ran everything through the formatter.

This commit is contained in:
Kevan Ahlquist 2015-08-25 00:59:54 -05:00
parent b7daf91723
commit 8a7f8f7c37
39 changed files with 1926 additions and 1566 deletions

View file

@ -1,19 +1,19 @@
describe('startContainerController', function() {
describe('startContainerController', function () {
var scope, $location, createController, mockContainer, $httpBackend;
beforeEach(angular.mock.module('dockerui'));
beforeEach(inject(function($rootScope, $controller, _$location_) {
beforeEach(inject(function ($rootScope, $controller, _$location_) {
$location = _$location_;
scope = $rootScope.$new();
createController = function() {
createController = function () {
return $controller('StartContainerController', {
'$scope': scope
});
};
angular.mock.inject(function(_Container_, _$httpBackend_) {
angular.mock.inject(function (_Container_, _$httpBackend_) {
mockContainer = _Container_;
$httpBackend = _$httpBackend_;
});
@ -34,8 +34,9 @@ describe('startContainerController', function() {
'Status': 'Up 2 minutes'
}]);
}
describe('Create and start a container with port bindings', function() {
it('should issue a correct create request to the Docker remote API', function() {
describe('Create and start a container with port bindings', function () {
it('should issue a correct create request to the Docker remote API', function () {
var controller = createController();
var id = '6abd8bfba81cf8a05a76a4bdefcb36c4b66cd02265f4bfcd0e236468696ebc6c';
var expectedBody = {
@ -76,8 +77,8 @@ describe('startContainerController', function() {
});
});
describe('Create and start a container with environment variables', function() {
it('should issue a correct create request to the Docker remote API', function() {
describe('Create and start a container with environment variables', function () {
it('should issue a correct create request to the Docker remote API', function () {
var controller = createController();
var id = '6abd8bfba81cf8a05a76a4bdefcb36c4b66cd02265f4bfcd0e236468696ebc6c';
var expectedBody = {
@ -110,8 +111,8 @@ describe('startContainerController', function() {
});
});
describe('Create and start a container with volumesFrom', function() {
it('should issue a correct create request to the Docker remote API', function() {
describe('Create and start a container with volumesFrom', function () {
it('should issue a correct create request to the Docker remote API', function () {
var controller = createController();
var id = '6abd8bfba81cf8a05a76a4bdefcb36c4b66cd02265f4bfcd0e236468696ebc6c';
var expectedBody = {
@ -133,15 +134,15 @@ describe('startContainerController', function() {
});
scope.config.name = 'container-name';
scope.config.HostConfig.VolumesFrom = [{name: 'parent'}, {name:'other:ro'}];
scope.config.HostConfig.VolumesFrom = [{name: 'parent'}, {name: 'other:ro'}];
scope.create();
$httpBackend.flush();
});
});
describe('Create and start a container with multiple options', function() {
it('should issue a correct create request to the Docker remote API', function() {
describe('Create and start a container with multiple options', function () {
it('should issue a correct create request to the Docker remote API', function () {
var controller = createController();
var id = '6abd8bfba81cf8a05a76a4bdefcb36c4b66cd02265f4bfcd0e236468696ebc6c';
var expectedBody = {
@ -154,8 +155,12 @@ describe('startContainerController', function() {
DnsSearch: ['example.com'],
CapAdd: ['cap_sys_admin'],
CapDrop: ['cap_foo_bar'],
Devices: [{ 'PathOnHost': '/dev/deviceName', 'PathInContainer': '/dev/deviceName', 'CgroupPermissions': 'mrw'}],
LxcConf: {'lxc.utsname':'docker'},
Devices: [{
'PathOnHost': '/dev/deviceName',
'PathInContainer': '/dev/deviceName',
'CgroupPermissions': 'mrw'
}],
LxcConf: {'lxc.utsname': 'docker'},
ExtraHosts: ['hostname:127.0.0.1'],
RestartPolicy: {name: 'always', MaximumRetryCount: 5}
},
@ -190,7 +195,11 @@ describe('startContainerController', function() {
scope.config.HostConfig.PublishAllPorts = true;
scope.config.HostConfig.Privileged = true;
scope.config.HostConfig.RestartPolicy = {name: 'always', MaximumRetryCount: 5};
scope.config.HostConfig.Devices = [{ 'PathOnHost': '/dev/deviceName', 'PathInContainer': '/dev/deviceName', 'CgroupPermissions': 'mrw'}];
scope.config.HostConfig.Devices = [{
'PathOnHost': '/dev/deviceName',
'PathInContainer': '/dev/deviceName',
'CgroupPermissions': 'mrw'
}];
scope.config.HostConfig.LxcConf = [{name: 'lxc.utsname', value: 'docker'}];
scope.config.HostConfig.ExtraHosts = [{host: 'hostname', ip: '127.0.0.1'}];

View file

@ -2,40 +2,40 @@ describe('filters', function () {
beforeEach(module('dockerui.filters'));
describe('truncate', function () {
it('should truncate the string to 10 characters ending in "..." by default', inject(function(truncateFilter) {
it('should truncate the string to 10 characters ending in "..." by default', inject(function (truncateFilter) {
expect(truncateFilter('this is 20 chars long')).toBe('this is...');
}));
it('should truncate the string to 7 characters ending in "..."', inject(function(truncateFilter) {
it('should truncate the string to 7 characters ending in "..."', inject(function (truncateFilter) {
expect(truncateFilter('this is 20 chars long', 7)).toBe('this...');
}));
it('should truncate the string to 10 characters ending in "???"', inject(function(truncateFilter) {
it('should truncate the string to 10 characters ending in "???"', inject(function (truncateFilter) {
expect(truncateFilter('this is 20 chars long', 10, '???')).toBe('this is???');
}));
});
describe('statusbadge', function () {
it('should be "important" when input is "Ghost"', inject(function(statusbadgeFilter) {
it('should be "important" when input is "Ghost"', inject(function (statusbadgeFilter) {
expect(statusbadgeFilter('Ghost')).toBe('important');
}));
it('should be "success" when input is "Exit 0"', inject(function(statusbadgeFilter) {
it('should be "success" when input is "Exit 0"', inject(function (statusbadgeFilter) {
expect(statusbadgeFilter('Exit 0')).toBe('success');
}));
it('should be "warning" when exit code is non-zero', inject(function(statusbadgeFilter) {
it('should be "warning" when exit code is non-zero', inject(function (statusbadgeFilter) {
expect(statusbadgeFilter('Exit 1')).toBe('warning');
}));
});
describe('getstatetext', function () {
it('should return an empty string when state is undefined', inject(function(getstatetextFilter) {
it('should return an empty string when state is undefined', inject(function (getstatetextFilter) {
expect(getstatetextFilter(undefined)).toBe('');
}));
it('should detect a Ghost state', inject(function(getstatetextFilter) {
it('should detect a Ghost state', inject(function (getstatetextFilter) {
var state = {
Ghost: true,
Running: true,
@ -44,7 +44,7 @@ describe('filters', function () {
expect(getstatetextFilter(state)).toBe('Ghost');
}));
it('should detect a Paused state', inject(function(getstatetextFilter) {
it('should detect a Paused state', inject(function (getstatetextFilter) {
var state = {
Ghost: false,
Running: true,
@ -53,7 +53,7 @@ describe('filters', function () {
expect(getstatetextFilter(state)).toBe('Running (Paused)');
}));
it('should detect a Running state', inject(function(getstatetextFilter) {
it('should detect a Running state', inject(function (getstatetextFilter) {
var state = {
Ghost: false,
Running: true,
@ -62,7 +62,7 @@ describe('filters', function () {
expect(getstatetextFilter(state)).toBe('Running');
}));
it('should detect a Stopped state', inject(function(getstatetextFilter) {
it('should detect a Stopped state', inject(function (getstatetextFilter) {
var state = {
Ghost: false,
Running: false,
@ -73,11 +73,11 @@ describe('filters', function () {
});
describe('getstatelabel', function () {
it('should return an empty string when state is undefined', inject(function(getstatelabelFilter) {
it('should return an empty string when state is undefined', inject(function (getstatelabelFilter) {
expect(getstatelabelFilter(undefined)).toBe('');
}));
it('should return label-important when a ghost state is detected', inject(function(getstatelabelFilter) {
it('should return label-important when a ghost state is detected', inject(function (getstatelabelFilter) {
var state = {
Ghost: true,
Running: true,
@ -86,7 +86,7 @@ describe('filters', function () {
expect(getstatelabelFilter(state)).toBe('label-important');
}));
it('should return label-success when a running state is detected', inject(function(getstatelabelFilter) {
it('should return label-success when a running state is detected', inject(function (getstatelabelFilter) {
var state = {
Ghost: false,
Running: true,
@ -97,33 +97,33 @@ describe('filters', function () {
});
describe('humansize', function () {
it('should return n/a when size is zero', inject(function(humansizeFilter) {
it('should return n/a when size is zero', inject(function (humansizeFilter) {
expect(humansizeFilter(0)).toBe('n/a');
}));
it('should handle Bytes values', inject(function(humansizeFilter) {
it('should handle Bytes values', inject(function (humansizeFilter) {
expect(humansizeFilter(512)).toBe('512 Bytes');
}));
it('should handle KB values', inject(function(humansizeFilter) {
it('should handle KB values', inject(function (humansizeFilter) {
expect(humansizeFilter(5120)).toBe('5 KB');
}));
it('should handle MB values', inject(function(humansizeFilter) {
it('should handle MB values', inject(function (humansizeFilter) {
expect(humansizeFilter(5 * Math.pow(10, 6))).toBe('5 MB');
}));
it('should handle GB values', inject(function(humansizeFilter) {
it('should handle GB values', inject(function (humansizeFilter) {
expect(humansizeFilter(5 * Math.pow(10, 9))).toBe('5 GB');
}));
it('should handle TB values', inject(function(humansizeFilter) {
it('should handle TB values', inject(function (humansizeFilter) {
expect(humansizeFilter(5 * Math.pow(10, 12))).toBe('5 TB');
}));
});
describe('containername', function () {
it('should strip the leading slash from container name', inject(function(containernameFilter) {
it('should strip the leading slash from container name', inject(function (containernameFilter) {
var container = {
Names: ['/elegant_ardinghelli']
};
@ -133,14 +133,14 @@ describe('filters', function () {
});
describe('repotag', function () {
it('should not display empty repo tag', inject(function(repotagFilter) {
it('should not display empty repo tag', inject(function (repotagFilter) {
var image = {
RepoTags: ['<none>:<none>']
};
expect(repotagFilter(image)).toBe('');
}));
it('should display a normal repo tag', inject(function(repotagFilter) {
it('should display a normal repo tag', inject(function (repotagFilter) {
var image = {
RepoTags: ['ubuntu:latest']
};
@ -149,17 +149,207 @@ describe('filters', function () {
});
describe('getdate', function () {
it('should convert the Docker date to a human readable form', inject(function(getdateFilter) {
it('should convert the Docker date to a human readable form', inject(function (getdateFilter) {
expect(getdateFilter(1420424998)).toBe('Sun Jan 04 2015');
}));
});
describe('errorMsgFilter', function() {
describe('errorMsgFilter', function () {
it('should convert the $resource object to a string message',
inject(function(errorMsgFilter) {
var response = {'0':'C','1':'o','2':'n','3':'f','4':'l','5':'i','6':'c','7':'t','8':',','9':' ','10':'T','11':'h','12':'e','13':' ','14':'n','15':'a','16':'m','17':'e','18':' ','19':'u','20':'b','21':'u','22':'n','23':'t','24':'u','25':'-','26':'s','27':'l','28':'e','29':'e','30':'p','31':'-','32':'r','33':'u','34':'n','35':'t','36':'i','37':'m','38':'e','39':' ','40':'i','41':'s','42':' ','43':'a','44':'l','45':'r','46':'e','47':'a','48':'d','49':'y','50':' ','51':'a','52':'s','53':'s','54':'i','55':'g','56':'n','57':'e','58':'d','59':' ','60':'t','61':'o','62':' ','63':'b','64':'6','65':'9','66':'e','67':'5','68':'3','69':'a','70':'6','71':'2','72':'2','73':'c','74':'8','75':'.','76':' ','77':'Y','78':'o','79':'u','80':' ','81':'h','82':'a','83':'v','84':'e','85':' ','86':'t','87':'o','88':' ','89':'d','90':'e','91':'l','92':'e','93':'t','94':'e','95':' ','96':'(','97':'o','98':'r','99':' ','100':'r','101':'e','102':'n','103':'a','104':'m','105':'e','106':')','107':' ','108':'t','109':'h','110':'a','111':'t','112':' ','113':'c','114':'o','115':'n','116':'t','117':'a','118':'i','119':'n','120':'e','121':'r','122':' ','123':'t','124':'o','125':' ','126':'b','127':'e','128':' ','129':'a','130':'b','131':'l','132':'e','133':' ','134':'t','135':'o','136':' ','137':'a','138':'s','139':'s','140':'i','141':'g','142':'n','143':' ','144':'u','145':'b','146':'u','147':'n','148':'t','149':'u','150':'-','151':'s','152':'l','153':'e','154':'e','155':'p','156':'-','157':'r','158':'u','159':'n','160':'t','161':'i','162':'m','163':'e','164':' ','165':'t','166':'o','167':' ','168':'a','169':' ','170':'c','171':'o','172':'n','173':'t','174':'a','175':'i','176':'n','177':'e','178':'r','179':' ','180':'a','181':'g','182':'a','183':'i','184':'n','185':'.','186':'\n','$promise':{},'$resolved':true};
inject(function (errorMsgFilter) {
var response = {
'0': 'C',
'1': 'o',
'2': 'n',
'3': 'f',
'4': 'l',
'5': 'i',
'6': 'c',
'7': 't',
'8': ',',
'9': ' ',
'10': 'T',
'11': 'h',
'12': 'e',
'13': ' ',
'14': 'n',
'15': 'a',
'16': 'm',
'17': 'e',
'18': ' ',
'19': 'u',
'20': 'b',
'21': 'u',
'22': 'n',
'23': 't',
'24': 'u',
'25': '-',
'26': 's',
'27': 'l',
'28': 'e',
'29': 'e',
'30': 'p',
'31': '-',
'32': 'r',
'33': 'u',
'34': 'n',
'35': 't',
'36': 'i',
'37': 'm',
'38': 'e',
'39': ' ',
'40': 'i',
'41': 's',
'42': ' ',
'43': 'a',
'44': 'l',
'45': 'r',
'46': 'e',
'47': 'a',
'48': 'd',
'49': 'y',
'50': ' ',
'51': 'a',
'52': 's',
'53': 's',
'54': 'i',
'55': 'g',
'56': 'n',
'57': 'e',
'58': 'd',
'59': ' ',
'60': 't',
'61': 'o',
'62': ' ',
'63': 'b',
'64': '6',
'65': '9',
'66': 'e',
'67': '5',
'68': '3',
'69': 'a',
'70': '6',
'71': '2',
'72': '2',
'73': 'c',
'74': '8',
'75': '.',
'76': ' ',
'77': 'Y',
'78': 'o',
'79': 'u',
'80': ' ',
'81': 'h',
'82': 'a',
'83': 'v',
'84': 'e',
'85': ' ',
'86': 't',
'87': 'o',
'88': ' ',
'89': 'd',
'90': 'e',
'91': 'l',
'92': 'e',
'93': 't',
'94': 'e',
'95': ' ',
'96': '(',
'97': 'o',
'98': 'r',
'99': ' ',
'100': 'r',
'101': 'e',
'102': 'n',
'103': 'a',
'104': 'm',
'105': 'e',
'106': ')',
'107': ' ',
'108': 't',
'109': 'h',
'110': 'a',
'111': 't',
'112': ' ',
'113': 'c',
'114': 'o',
'115': 'n',
'116': 't',
'117': 'a',
'118': 'i',
'119': 'n',
'120': 'e',
'121': 'r',
'122': ' ',
'123': 't',
'124': 'o',
'125': ' ',
'126': 'b',
'127': 'e',
'128': ' ',
'129': 'a',
'130': 'b',
'131': 'l',
'132': 'e',
'133': ' ',
'134': 't',
'135': 'o',
'136': ' ',
'137': 'a',
'138': 's',
'139': 's',
'140': 'i',
'141': 'g',
'142': 'n',
'143': ' ',
'144': 'u',
'145': 'b',
'146': 'u',
'147': 'n',
'148': 't',
'149': 'u',
'150': '-',
'151': 's',
'152': 'l',
'153': 'e',
'154': 'e',
'155': 'p',
'156': '-',
'157': 'r',
'158': 'u',
'159': 'n',
'160': 't',
'161': 'i',
'162': 'm',
'163': 'e',
'164': ' ',
'165': 't',
'166': 'o',
'167': ' ',
'168': 'a',
'169': ' ',
'170': 'c',
'171': 'o',
'172': 'n',
'173': 't',
'174': 'a',
'175': 'i',
'176': 'n',
'177': 'e',
'178': 'r',
'179': ' ',
'180': 'a',
'181': 'g',
'182': 'a',
'183': 'i',
'184': 'n',
'185': '.',
'186': '\n',
'$promise': {},
'$resolved': true
};
var message = 'Conflict, The name ubuntu-sleep-runtime is already assigned to b69e53a622c8. You have to delete (or rename) that container to be able to assign ubuntu-sleep-runtime to a container again.\n';
expect(errorMsgFilter(response)).toBe(message);
}));
}));
});
});

View file

@ -3,19 +3,19 @@ basePath = '../..';
// list of files / patterns to load in the browser
files = [
JASMINE,
JASMINE_ADAPTER,
'assets/js/jquery-1.11.1.min.js',
'assets/js/jquery.gritter.min.js',
'assets/js/bootstrap.min.js',
'assets/js/spin.js',
'dist/angular.js',
'assets/js/ui-bootstrap/ui-bootstrap-custom-tpls-0.12.0.min.js',
'assets/js/angular-vis.js',
'test/assets/angular/angular-mocks.js',
'app/**/*.js',
'test/unit/**/*.spec.js',
'dist/templates/**/*.js'
JASMINE,
JASMINE_ADAPTER,
'assets/js/jquery-1.11.1.min.js',
'assets/js/jquery.gritter.min.js',
'assets/js/bootstrap.min.js',
'assets/js/spin.js',
'dist/angular.js',
'assets/js/ui-bootstrap/ui-bootstrap-custom-tpls-0.12.0.min.js',
'assets/js/angular-vis.js',
'test/assets/angular/angular-mocks.js',
'app/**/*.js',
'test/unit/**/*.spec.js',
'dist/templates/**/*.js'
];
// use dots reporter, as travis terminal does not support escaping sequences