mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 08:19:40 +02:00
Merge commit '964eac6d53
' into events
Conflicts: app/app.js test/unit/app/components/containerController.spec.js
This commit is contained in:
commit
2514672c35
8 changed files with 308 additions and 183 deletions
|
@ -1,4 +1,4 @@
|
|||
describe('ContainerController', function() {
|
||||
describe('ContainerController', function () {
|
||||
var $scope, $httpBackend, mockContainer, $routeParams;
|
||||
|
||||
beforeEach(module('dockerui'));
|
||||
|
@ -19,7 +19,7 @@ describe('ContainerController', function() {
|
|||
}));
|
||||
|
||||
function expectGetContainer() {
|
||||
$httpBackend.expectGET('dockerapi/containers/json').respond({
|
||||
$httpBackend.expectGET('dockerapi/containers/json?').respond({
|
||||
'Created': 1421817232,
|
||||
'id': 'b17882378cee8ec0136f482681b764cca430befd52a9bfd1bde031f49b8bba9f',
|
||||
'Image': 'dockerui:latest',
|
||||
|
@ -27,7 +27,7 @@ describe('ContainerController', function() {
|
|||
});
|
||||
}
|
||||
|
||||
it("a correct create request to the Docker remote API", function () {
|
||||
it("a correct rename request to the Docker remote API", function () {
|
||||
|
||||
$routeParams.id = 'b17882378cee8ec0136f482681b764cca430befd52a9bfd1bde031f49b8bba9f';
|
||||
$scope.container = {
|
||||
|
@ -41,7 +41,7 @@ describe('ContainerController', function() {
|
|||
var newContainerName = "newName";
|
||||
expectGetContainer();
|
||||
|
||||
$httpBackend.expectGET('dockerapi/containers/changes').respond([{"Kind":1,"Path":"/docker.sock"}]);
|
||||
$httpBackend.expectGET('dockerapi/containers/changes?').respond([{"Kind": 1, "Path": "/docker.sock"}]);
|
||||
|
||||
$httpBackend.expectPOST('dockerapi/containers/' + $routeParams.id + '/rename?name=newName').
|
||||
respond({
|
||||
|
|
31
test/unit/app/components/containerTopController.spec.js
Normal file
31
test/unit/app/components/containerTopController.spec.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
describe("ContainerTopController", function () {
|
||||
var $scope, $httpBackend, $routeParams;
|
||||
|
||||
beforeEach(angular.mock.module('dockerui'));
|
||||
|
||||
beforeEach(inject(function (_$rootScope_, _$httpBackend_, $controller, _$routeParams_) {
|
||||
$scope = _$rootScope_.$new();
|
||||
$httpBackend = _$httpBackend_;
|
||||
$routeParams = _$routeParams_;
|
||||
$routeParams.id = 'b17882378cee8ec0136f482681b764cca430befd52a9bfd1bde031f49b8bba9f';
|
||||
$controller('ContainerTopController', {
|
||||
'$scope': $scope,
|
||||
'$routeParams': $routeParams
|
||||
});
|
||||
}));
|
||||
|
||||
it("should test controller initialize", function () {
|
||||
$httpBackend.expectGET('dockerapi/containers/b17882378cee8ec0136f482681b764cca430befd52a9bfd1bde031f49b8bba9f/top?ps_args=').respond(200);
|
||||
expect($scope.ps_args).toBeDefined();
|
||||
$httpBackend.flush();
|
||||
});
|
||||
|
||||
it("a correct top request to the Docker remote API", function () {
|
||||
$httpBackend.expectGET('dockerapi/containers/' + $routeParams.id + '/top?ps_args=').respond(200);
|
||||
$routeParams.id = '123456789123456789123456789';
|
||||
$scope.ps_args = 'aux';
|
||||
$httpBackend.expectGET('dockerapi/containers/' + $routeParams.id + '/top?ps_args=' + $scope.ps_args).respond(200);
|
||||
$scope.getTop();
|
||||
$httpBackend.flush();
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue