Skip to content

Commit 33e4c73

Browse files
committed
Add basic test for GMN home/status page
1 parent 3ec8f46 commit 33e4c73

File tree

2 files changed

+174
-0
lines changed

2 files changed

+174
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
# This work was created by participants in the DataONE project, and is
5+
# jointly copyrighted by participating institutions in DataONE. For
6+
# more information on DataONE, see our web site at http://dataone.org.
7+
#
8+
# Copyright 2009-2016 DataONE
9+
#
10+
# Licensed under the Apache License, Version 2.0 (the "License");
11+
# you may not use this file except in compliance with the License.
12+
# You may obtain a copy of the License at
13+
#
14+
# http://www.apache.org/licenses/LICENSE-2.0
15+
#
16+
# Unless required by applicable law or agreed to in writing, software
17+
# distributed under the License is distributed on an "AS IS" BASIS,
18+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19+
# See the License for the specific language governing permissions and
20+
# limitations under the License.
21+
"""Basic tests for the template based pages
22+
"""
23+
24+
from __future__ import absolute_import
25+
26+
import responses
27+
28+
import d1_gmn.tests.gmn_test_case
29+
import d1_gmn.tests.gmn_test_client
30+
31+
import d1_test.mock_api.get_system_metadata
32+
33+
import django
34+
import django.conf
35+
import django.core.management
36+
import django.test
37+
38+
39+
@d1_test.d1_test_case.reproducible_random_decorator('TestTemplates')
40+
class TestTemplates(d1_gmn.tests.gmn_test_case.GMNTestCase):
41+
@responses.activate
42+
def test_1000(self):
43+
"""home: Returns expected HTML document and status 200"""
44+
response = django.test.Client().get('/home')
45+
assert response.status_code == 200
46+
self.sample.assert_equals(response.content, 'home_html_doc')
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
<html xmlns="http://www.w3.org/1999/xhtml">
2+
<head>
3+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
4+
5+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
6+
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/start/jquery-ui.css">
7+
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
8+
9+
<script type="text/javascript">
10+
11+
$(function () {
12+
$("#tabs").tabs();
13+
});
14+
15+
</script>
16+
17+
<style type="text/css">
18+
table {
19+
}
20+
21+
td {
22+
vertical-align: top;
23+
padding-right: 10px;
24+
}
25+
26+
div.description {
27+
font-size: medium;
28+
}
29+
30+
div.logoheader {
31+
background: transparent url("/static/images/preface-wrapper-bg.png") repeat-x top left;
32+
height: 101px;
33+
}
34+
35+
div.logoheader h1 {
36+
background: transparent url("/static/images/d1_logo.png") no-repeat top left;
37+
margin: 10px 9px;
38+
width: 333px;
39+
height: 77px;
40+
float: left;
41+
}
42+
43+
</style>
44+
45+
</head>
46+
47+
<body>
48+
<div class="logoheader"><h1></h1></div>
49+
50+
<div id="tabs">
51+
52+
<ul>
53+
<li><a href="#memberNode">Member Node Details</a></li>
54+
<li><a href="#description">Description</a></li>
55+
</ul>
56+
57+
<div id="memberNode">
58+
<table>
59+
<tbody>
60+
<tr>
61+
<td>Node ID:</td>
62+
<td>urn:node:GMNUnitTestInstance</td>
63+
</tr>
64+
<tr>
65+
<td>Name:</td>
66+
<td>GMN Unit Test Instance</td>
67+
</tr>
68+
<tr>
69+
<td>GMN version:</td>
70+
<td>2.4.1</td>
71+
</tr>
72+
<tr>
73+
<td>Django version:</td>
74+
<td>1, 11, 7, final, 0</td>
75+
</tr>
76+
<tr>
77+
<td>Average size of Science objects:</td>
78+
<td>273 bytes</td>
79+
</tr>
80+
<tr>
81+
<td>Objects:</td>
82+
<td>1,000</td>
83+
</tr>
84+
<tr>
85+
<td>Operations, total:</td>
86+
<td>3,236</td>
87+
</tr>
88+
<tr>
89+
<td>Operations, last hour:</td>
90+
<td>632</td>
91+
</tr>
92+
<tr>
93+
<td>Subjects:</td>
94+
<td>1,156</td>
95+
</tr>
96+
<tr>
97+
<td>Permissions:</td>
98+
<td>8,045</td>
99+
</tr>
100+
<tr>
101+
<td>Server time:</td>
102+
<td>Dec. 7, 2017, 4:19 p.m.</td>
103+
</tr>
104+
<tr>
105+
<td>Storage used / remaining:</td>
106+
<td>0 GiB / 22 GiB</td>
107+
</tr>
108+
<tr>
109+
<td>Science objects by Format:</td>
110+
<td>
111+
<table>
112+
<tbody>
113+
114+
</tbody>
115+
</table>
116+
</td>
117+
</tr>
118+
</tbody>
119+
</table>
120+
</div>
121+
122+
<div id="description" class="description">
123+
GMN instance launched via pytest
124+
</div>
125+
126+
</div>
127+
</body>
128+
</html>

0 commit comments

Comments
 (0)