tracim.tests.models.test_user   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 28
dl 0
loc 44
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A TestUserModel.test_null_password() 0 12 1
A TestUserModel.test_create() 0 19 1
1
# -*- coding: utf-8 -*-
0 ignored issues
show
Coding Style introduced by
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2
import transaction
3
4
from tracim.tests import eq_
5
from tracim.tests import BaseTest
6
7
from tracim.models.auth import User
8
9
10
class TestUserModel(BaseTest):
0 ignored issues
show
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Unused Code introduced by
The variable __class__ seems to be unused.
Loading history...
11
12
    def test_create(self):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
13
        self.session.flush()
14
        transaction.commit()
15
        name = 'Damien'
16
        email = '[email protected]'
17
18
        user = User()
19
        user.display_name = name
20
        user.email = email
21
22
        self.session.add(user)
23
        self.session.flush()
24
        transaction.commit()
25
26
        new_user = self.session.query(User).filter(User.display_name==name).one()
0 ignored issues
show
Coding Style introduced by
Exactly one space required around comparison
Loading history...
27
28
        eq_(new_user.display_name, name)
29
        eq_(new_user.email, email)
30
        eq_(new_user.email_address, email)
31
32
    def test_null_password(self):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
33
        # Check bug #70 fixed
34
        # http://tracim.org/workspaces/4/folders/5/threads/70
35
36
        name = 'Damien'
37
        email = '[email protected]'
38
39
        user = User()
40
        user.display_name = name
41
        user.email = email
42
43
        eq_(False, user.validate_password(None))
44