• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gocept / gocept.selenium / 6444675817

05 Oct 2023 09:33AM CUT coverage: 77.82%. Remained the same
6444675817

push

github

web-flow
Fix path

284 of 370 branches covered (0.0%)

Branch coverage included in aggregate %.

951 of 1217 relevant lines covered (78.14%)

3.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/src/gocept/selenium/wsgi/testing.py
1
#############################################################################
2
#
3
# Copyright (c) 2010 Zope Foundation and Contributors.
4
# All Rights Reserved.
5
#
6
# This software is subject to the provisions of the Zope Public License,
7
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
8
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11
# FOR A PARTICULAR PURPOSE.
12
#
13
##############################################################################
14

15

16
class SimpleApp:
5✔
17

18
    def __call__(self, environ, start_response):
5✔
19
        path = environ['PATH_INFO']
5✔
20

21
        statuscode = '404 Not Found'
5✔
22
        body = [b'Not Found']
5✔
23
        headers = []
5✔
24
        if path == '/':
5✔
25
            statuscode = '200 OK'
5✔
26
            headers.append(('Content-Type', 'text/html'))
5✔
27
            body = [b'''
5✔
28
              <html>
29
              <head>
30
                <script src="colors.js"></script>
31
              </head>
32
              <body>
33
                <p id="foo">Testing...</p>
34
              </body>
35
              </html>''']
36
        elif path == '/colors.js':
5!
37
            statuscode = '200 OK'
5✔
38
            headers.append(('Content-Type', 'text/javascript'))
5✔
39
            body = [b'''
5✔
40
var hello = function hello () {
41
    document.getElementById('foo').innerHTML = 'Hello from javascript';
42
};
43
window.onload = hello;''']
44
        start_response(statuscode, headers)
5✔
45
        return body
5✔
46

47

48
class SimpleApp2:
5✔
49

50
    def __call__(self, environ, start_response):
5✔
51
        start_response('200 OK', [('Content-Type', 'text/html')])
×
52
        return '<html><head></head><body>simple</body></html>'
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc