Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AmendsenProject
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shaik Janipasha
AmendsenProject
Commits
52131b4a
Unverified
Commit
52131b4a
authored
Mar 24, 2020
by
Tao Feng
Committed by
GitHub
Mar 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Slight change from title to role name (#228)
parent
a47f9adc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
12 deletions
+10
-12
user.py
databuilder/models/user.py
+6
-6
test_table_column_usage.py
tests/unit/models/test_table_column_usage.py
+1
-1
test_user.py
tests/unit/models/test_user.py
+3
-5
No files found.
databuilder/models/user.py
View file @
52131b4a
...
...
@@ -25,7 +25,7 @@ class User(Neo4jCsvSerializable):
USER_NODE_SLACK_ID
=
'slack_id'
USER_NODE_IS_ACTIVE
=
'is_active{}'
.
format
(
UNQUOTED_SUFFIX
)
# bool value needs to be unquoted when publish to neo4j
USER_NODE_UPDATED_AT
=
'updated_at'
USER_NODE_
TITLE
=
'titl
e'
USER_NODE_
ROLE_NAME
=
'role_nam
e'
USER_MANAGER_RELATION_TYPE
=
'MANAGE_BY'
MANAGER_USER_RELATION_TYPE
=
'MANAGE'
...
...
@@ -42,7 +42,7 @@ class User(Neo4jCsvSerializable):
slack_id
=
''
,
# type: str
is_active
=
True
,
# type: bool
updated_at
=
0
,
# type: int
titl
e
=
''
,
# type: str
role_nam
e
=
''
,
# type: str
**
kwargs
# type: Dict
):
# type: (...) -> None
...
...
@@ -61,7 +61,7 @@ class User(Neo4jCsvSerializable):
:param updated_at: everytime we update the node, we will push the timestamp.
then we will have a cron job to update the ex-employee nodes based on
the case if this timestamp hasn't been updated for two weeks.
:param
title: the titl
e of the user (e.g swe)
:param
role_name: the role_nam
e of the user (e.g swe)
:param kwargs: Any K/V attributes we want to update the
"""
self
.
first_name
=
first_name
...
...
@@ -78,7 +78,7 @@ class User(Neo4jCsvSerializable):
self
.
slack_id
=
slack_id
self
.
is_active
=
is_active
self
.
updated_at
=
updated_at
self
.
title
=
titl
e
self
.
role_name
=
role_nam
e
self
.
attrs
=
None
if
kwargs
:
self
.
attrs
=
copy
.
deepcopy
(
kwargs
)
...
...
@@ -133,7 +133,7 @@ class User(Neo4jCsvSerializable):
result_node
[
User
.
USER_NODE_EMPLOYEE_TYPE
]
=
self
.
employee_type
if
self
.
employee_type
else
''
result_node
[
User
.
USER_NODE_SLACK_ID
]
=
self
.
slack_id
if
self
.
slack_id
else
''
result_node
[
User
.
USER_NODE_UPDATED_AT
]
=
self
.
updated_at
if
self
.
updated_at
else
0
result_node
[
User
.
USER_NODE_
TITLE
]
=
self
.
title
if
self
.
titl
e
else
''
result_node
[
User
.
USER_NODE_
ROLE_NAME
]
=
self
.
role_name
if
self
.
role_nam
e
else
''
if
self
.
attrs
:
for
k
,
v
in
self
.
attrs
.
items
():
...
...
@@ -170,4 +170,4 @@ class User(Neo4jCsvSerializable):
self
.
employee_type
,
self
.
is_active
,
self
.
updated_at
,
self
.
titl
e
)
self
.
role_nam
e
)
tests/unit/models/test_table_column_usage.py
View file @
52131b4a
...
...
@@ -32,7 +32,7 @@ class TestTableColumnUsage(unittest.TestCase):
'github_username'
:
''
,
'team_name'
:
''
,
'email'
:
'john@example.com'
,
'
titl
e'
:
''
}]
'
role_nam
e'
:
''
}]
self
.
assertEqual
(
expected
,
actual
)
rel_row
=
table_col_usage
.
next_relation
()
...
...
tests/unit/models/test_user.py
View file @
52131b4a
...
...
@@ -22,7 +22,7 @@ class TestUser(unittest.TestCase):
slack_id
=
'slack'
,
is_active
=
True
,
updated_at
=
1
,
titl
e
=
'swe'
)
role_nam
e
=
'swe'
)
def
test_get_user_model_key
(
self
):
# type: () -> None
...
...
@@ -46,13 +46,11 @@ class TestUser(unittest.TestCase):
slack_id
=
'slack'
,
is_active
=
True
,
updated_at
=
1
,
title
=
'swe'
,
role
=
'SWE'
,
role_name
=
'swe'
,
enable_notify
=
True
)
nodes
=
test_user
.
create_nodes
()
self
.
assertEqual
(
nodes
[
0
][
'email'
],
'test@email.com'
)
self
.
assertEqual
(
nodes
[
0
][
'role'
],
'SWE'
)
self
.
assertEqual
(
nodes
[
0
][
'title'
],
'swe'
)
self
.
assertEqual
(
nodes
[
0
][
'role_name'
],
'swe'
)
self
.
assertTrue
(
nodes
[
0
][
'enable_notify'
])
def
test_create_relation
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment