Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix feed status command #1628

Merged
merged 3 commits into from
Sep 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
requests in gsad [#1355](https://github.com/greenbone/gsa/pull/1355)

### Fixed
- Fixed feed status page does not render [#1628](https://github.com/greenbone/gsa/pull/1628)
- fixed secinfo severitybars not displaying severity.[#1530](https://github.com/greenbone/gsa/pull/1530)
- Fixed outer click issues for multi select and select boxes
[#1504](https://github.com/greenbone/gsa/pull/1504)
Expand Down
59 changes: 59 additions & 0 deletions gsa/src/gmp/commands/__tests__/feedstatus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/* Copyright (C) 2019 Greenbone Networks GmbH
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/

import {createResponse, createHttp} from '../testing';

import {FeedStatus} from '../feedstatus';

describe('FeedStatusCommand tests', () => {
test('should return feed information', () => {
const response = createResponse({
get_feeds: {
get_feeds_response: {
feed: {
type: 'NVT',
name: 'foo',
version: 201906251319,
description: 'bar',
},
},
},
});

const fakeHttp = createHttp(response);

expect.hasAssertions();

const cmd = new FeedStatus(fakeHttp);
return cmd.readFeedInformation().then(resp => {
expect(fakeHttp.request).toHaveBeenCalledWith('get', {
args: {
cmd: 'get_feeds',
},
});

const {data} = resp;
expect(data[0].feed_type).toEqual('NVT');
expect(data[0].name).toEqual('foo');
expect(data[0].description).toEqual('bar');
expect(data[0].status).toEqual(undefined);
expect(data[0].version).toEqual('20190625T1319');
});
});
});
4 changes: 2 additions & 2 deletions gsa/src/gmp/commands/feedstatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import date, {duration} from '../models/date';
import HttpCommand from './http';

const convertVersion = version =>
version.slice(0, 8) + 'T' + version.slice(8, 12);
`${version}`.slice(0, 8) + 'T' + `${version}`.slice(8, 12);

export const NVT_FEED = 'NVT';
export const CERT_FEED = 'CERT';
Expand All @@ -48,7 +48,7 @@ class Feed {
}
}

class FeedStatus extends HttpCommand {
export class FeedStatus extends HttpCommand {
constructor(http) {
super(http, {cmd: 'get_feeds'});
}
Expand Down