Passed
Push — master ( e99931...5fbe00 )
by -
01:39
created

FlaskrTestCase.test_plain()   A

Complexity

Conditions 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2
Metric Value
cc 2
dl 0
loc 7
ccs 6
cts 6
cp 1
crap 2
rs 9.4285
1 1
from time import strftime, localtime
0 ignored issues
show
Unused Code introduced by
Unused localtime imported from time
Loading history...
Unused Code introduced by
Unused strftime imported from time
Loading history...
2
3 1
try:
4 1
    from urlparse import urlparse
5
except ImportError:  # python3
6
    from urllib.parse import urlparse
7
8 1
from spike import create_app, seeds
9 1
from spike.model import db
10 1
import unittest
11
12
13 1
class FlaskrTestCase(unittest.TestCase):
14 1
    def setUp(self):
15 1
        app = create_app('../config.cfg')
16 1
        db.init_app(app)
17 1
        app.config['TESTING'] = True
18 1
        self.app = app.test_client()
19
20 1
    def tearDown(self):
21 1
        pass
22
23 1
    def test_index(self):
24 1
        rv = self.app.get('/rulesets', follow_redirects=False)
0 ignored issues
show
Coding Style Naming introduced by
The name rv does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
25 1
        self.assertEqual(rv.status_code, 301)
26 1
        self.assertEqual(urlparse(rv.location).path, '/rulesets/')
27
28 1
    def test_plain(self):
29 1
        rv = self.app.get('/rulesets/plain', follow_redirects=False)
0 ignored issues
show
Coding Style Naming introduced by
The name rv does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
30 1
        self.assertEqual(rv.status_code, 301)
31
32 1
        rv = self.app.get('/rulesets/plain', follow_redirects=True)
0 ignored issues
show
Coding Style Naming introduced by
The name rv does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
33
        for seed in seeds.rulesets_seeds:
34
            self.assertIn(seed, rv.data)
0 ignored issues
show
Coding Style introduced by
Final newline missing
Loading history...