From 41156bfef83486e9ade285305eb43cca26de17ad Mon Sep 17 00:00:00 2001 From: Sarah Diedrich Date: Fri, 13 Sep 2019 12:02:15 +0200 Subject: [PATCH 1/3] fix feed status command --- gsa/src/gmp/commands/feedstatus.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gsa/src/gmp/commands/feedstatus.js b/gsa/src/gmp/commands/feedstatus.js index 2a602f67f2..da9e6c1482 100644 --- a/gsa/src/gmp/commands/feedstatus.js +++ b/gsa/src/gmp/commands/feedstatus.js @@ -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'; From e2e13dbfb77a719cd094e25f344475f51524cf19 Mon Sep 17 00:00:00 2001 From: Sarah Diedrich Date: Fri, 13 Sep 2019 12:10:33 +0200 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd6e6fbafb..41a9618112 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) From 77a79a4e11b49ccc5a070b04dcfab92a42833c53 Mon Sep 17 00:00:00 2001 From: Sarah Diedrich Date: Fri, 13 Sep 2019 13:06:37 +0200 Subject: [PATCH 3/3] add tests for feed status command --- gsa/src/gmp/commands/__tests__/feedstatus.js | 59 ++++++++++++++++++++ gsa/src/gmp/commands/feedstatus.js | 2 +- 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 gsa/src/gmp/commands/__tests__/feedstatus.js diff --git a/gsa/src/gmp/commands/__tests__/feedstatus.js b/gsa/src/gmp/commands/__tests__/feedstatus.js new file mode 100644 index 0000000000..fd4d81ce7d --- /dev/null +++ b/gsa/src/gmp/commands/__tests__/feedstatus.js @@ -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'); + }); + }); +}); diff --git a/gsa/src/gmp/commands/feedstatus.js b/gsa/src/gmp/commands/feedstatus.js index da9e6c1482..ffd3f8d5c9 100644 --- a/gsa/src/gmp/commands/feedstatus.js +++ b/gsa/src/gmp/commands/feedstatus.js @@ -48,7 +48,7 @@ class Feed { } } -class FeedStatus extends HttpCommand { +export class FeedStatus extends HttpCommand { constructor(http) { super(http, {cmd: 'get_feeds'}); }