##// END OF EJS Templates
tests: fix accidentally broken tests.
marcink -
r1162:3ed6ccb0 default
parent child Browse files
Show More
@@ -1,78 +1,84 b''
1 1 # -*- coding: utf-8 -*-
2 2
3 3 # Copyright (C) 2010-2016 RhodeCode GmbH
4 4 #
5 5 # This program is free software: you can redistribute it and/or modify
6 6 # it under the terms of the GNU Affero General Public License, version 3
7 7 # (only), as published by the Free Software Foundation.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU Affero General Public License
15 15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 16 #
17 17 # This program is dual-licensed. If you wish to learn more about the
18 18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21
22 22 import pytest
23 23
24 24 from rhodecode.model.scm import ScmModel
25 25 from rhodecode.api.tests.utils import build_data, api_call, assert_ok
26 26
27 27
28 28 @pytest.fixture
29 29 def http_host_stub():
30 30 """
31 31 To ensure that we can get an IP address, this test shall run with a
32 32 hostname set to "localhost".
33 33 """
34 34 return 'localhost:80'
35 35
36 36
37 37 @pytest.mark.usefixtures("testuser_api", "app")
38 38 class TestGetServerInfo(object):
39 39 def test_api_get_server_info(self):
40 40 id_, params = build_data(self.apikey, 'get_server_info')
41 41 response = api_call(self.app, params)
42 42 resp = response.json
43 43 expected = ScmModel().get_server_info()
44 44 expected['memory'] = resp['result']['memory']
45 45 expected['uptime'] = resp['result']['uptime']
46 46 expected['load'] = resp['result']['load']
47 47 expected['cpu'] = resp['result']['cpu']
48 48 expected['storage'] = resp['result']['storage']
49 49 expected['storage_temp'] = resp['result']['storage_temp']
50 50 expected['storage_inodes'] = resp['result']['storage_inodes']
51 51 expected['server'] = resp['result']['server']
52 52
53 expected['index_storage'] = resp['result']['index_storage']
54 expected['storage'] = resp['result']['storage']
55
53 56 assert_ok(id_, expected, given=response.body)
54 57
55 58 def test_api_get_server_info_ip(self):
56 59 id_, params = build_data(self.apikey, 'get_server_info')
57 60 response = api_call(self.app, params)
58 61 resp = response.json
59 62 expected = ScmModel().get_server_info({'SERVER_NAME': 'unknown'})
60 63 expected['memory'] = resp['result']['memory']
61 64 expected['uptime'] = resp['result']['uptime']
62 65 expected['load'] = resp['result']['load']
63 66 expected['cpu'] = resp['result']['cpu']
64 67 expected['storage'] = resp['result']['storage']
65 68 expected['storage_temp'] = resp['result']['storage_temp']
66 69 expected['storage_inodes'] = resp['result']['storage_inodes']
67 70 expected['server'] = resp['result']['server']
68 71
72 expected['index_storage'] = resp['result']['index_storage']
73 expected['storage'] = resp['result']['storage']
74
69 75 assert_ok(id_, expected, given=response.body)
70 76
71 77 def test_api_get_server_info_data_for_search_index_build(self):
72 78 id_, params = build_data(self.apikey, 'get_server_info')
73 79 response = api_call(self.app, params)
74 80 resp = response.json
75 81
76 82 # required by indexer
77 83 assert resp['result']['index_storage']
78 84 assert resp['result']['storage']
General Comments 0
You need to be logged in to leave comments. Login now