tracim.fixtures.users_and_groups   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 52
dl 0
loc 64
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
B Base.insert() 0 32 1
A Test.insert() 0 17 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
from tracim import models
3
from tracim.fixtures import Fixture
4
from tracim.lib.core.user import UserApi
5
6
7
class Base(Fixture):
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...
8
    require = []
9
10
    def insert(self):
11
        u = models.User()
0 ignored issues
show
Coding Style Naming introduced by
The name u does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

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...
12
        u.display_name = 'Global manager'
13
        u.email = '[email protected]'
14
        u.password = '[email protected]'
15
        self._session.add(u)
16
        uapi = UserApi(
17
            session=self._session,
18
            config=self._config,
19
            current_user=u)
20
        uapi.execute_created_user_actions(u)
21
22
        g1 = models.Group()
0 ignored issues
show
Coding Style Naming introduced by
The name g1 does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

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...
23
        g1.group_id = 1
24
        g1.group_name = 'users'
25
        g1.display_name = 'Users'
26
        g1.users.append(u)
27
        self._session.add(g1)
28
29
        g2 = models.Group()
0 ignored issues
show
Coding Style Naming introduced by
The name g2 does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

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
        g2.group_id = 2
31
        g2.group_name = 'managers'
32
        g2.display_name = 'Global Managers'
33
        g2.users.append(u)
34
        self._session.add(g2)
35
36
        g3 = models.Group()
0 ignored issues
show
Coding Style Naming introduced by
The name g3 does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

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...
37
        g3.group_id = 3
38
        g3.group_name = 'administrators'
39
        g3.display_name = 'Administrators'
40
        g3.users.append(u)
41
        self._session.add(g3)
42
43
44
class Test(Fixture):
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...
45
    require = [Base, ]
46
47
    def insert(self):
48
        g2 = self._session.query(models.Group).\
0 ignored issues
show
Coding Style Naming introduced by
The name g2 does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

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...
49
            filter(models.Group.group_name == 'managers').one()
50
51
        lawrence = models.User()
52
        lawrence.display_name = 'Lawrence L.'
53
        lawrence.email = '[email protected]'
54
        lawrence.password = 'foobarbaz'
55
        self._session.add(lawrence)
56
        g2.users.append(lawrence)
57
58
        bob = models.User()
59
        bob.display_name = 'Bob i.'
60
        bob.email = '[email protected]'
61
        bob.password = 'foobarbaz'
62
        self._session.add(bob)
63
        g2.users.append(bob)
64