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
4af09d85
Unverified
Commit
4af09d85
authored
Mar 11, 2019
by
Tao Feng
Committed by
GitHub
Mar 11, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16 from lyft/tfeng_update_user
Update user model
parents
3b89a78f
545e43c7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
38 deletions
+31
-38
user.py
databuilder/models/user.py
+18
-25
setup.py
setup.py
+1
-1
test_table_column_usage.py
tests/unit/models/test_table_column_usage.py
+12
-12
No files found.
databuilder/models/user.py
View file @
4af09d85
...
@@ -57,17 +57,18 @@ class User(Neo4jCsvSerializable):
...
@@ -57,17 +57,18 @@ class User(Neo4jCsvSerializable):
then we will have a cron job to update the ex-employee nodes based on
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.
the case if this timestamp hasn't been updated for two weeks.
"""
"""
self
.
first_name
=
first_name
self
.
first_name
=
first_name
.
encode
(
'utf-8'
)
self
.
last_name
=
last_name
self
.
last_name
=
last_name
.
encode
(
'utf-8'
)
self
.
name
=
name
self
.
name
=
name
.
encode
(
'utf-8'
)
self
.
email
=
email
self
.
github_username
=
github_username
self
.
email
=
email
.
encode
(
'utf-8'
)
self
.
github_username
=
github_username
.
encode
(
'utf-8'
)
# todo: team will be a separate node once Amundsen People supports team
# todo: team will be a separate node once Amundsen People supports team
self
.
team_name
=
team_name
self
.
team_name
=
team_name
.
encode
(
'utf-8'
)
self
.
manager_email
=
manager_email
self
.
manager_email
=
manager_email
.
encode
(
'utf-8'
)
self
.
employee_type
=
employee_type
self
.
employee_type
=
employee_type
.
encode
(
'utf-8'
)
# this attr not available in team service, either update team service, update with FE
# this attr not available in team service, either update team service, update with FE
self
.
slack_id
=
slack_id
self
.
slack_id
=
slack_id
.
encode
(
'utf-8'
)
self
.
is_active
=
is_active
self
.
is_active
=
is_active
self
.
updated_at
=
updated_at
self
.
updated_at
=
updated_at
...
@@ -113,22 +114,14 @@ class User(Neo4jCsvSerializable):
...
@@ -113,22 +114,14 @@ class User(Neo4jCsvSerializable):
User
.
USER_NODE_IS_ACTIVE
:
self
.
is_active
,
User
.
USER_NODE_IS_ACTIVE
:
self
.
is_active
,
}
}
if
self
.
first_name
:
result_node
[
User
.
USER_NODE_FIRST_NAME
]
=
self
.
first_name
if
self
.
first_name
else
''
result_node
[
User
.
USER_NODE_FIRST_NAME
]
=
self
.
first_name
result_node
[
User
.
USER_NODE_LAST_NAME
]
=
self
.
last_name
if
self
.
last_name
else
''
if
self
.
last_name
:
result_node
[
User
.
USER_NODE_FULL_NAME
]
=
self
.
name
if
self
.
name
else
''
result_node
[
User
.
USER_NODE_LAST_NAME
]
=
self
.
last_name
result_node
[
User
.
USER_NODE_GITHUB_NAME
]
=
self
.
github_username
if
self
.
github_username
else
''
if
self
.
name
:
result_node
[
User
.
USER_NODE_TEAM
]
=
self
.
team_name
if
self
.
team_name
else
''
result_node
[
User
.
USER_NODE_FULL_NAME
]
=
self
.
name
result_node
[
User
.
USER_NODE_EMPLOYEE_TYPE
]
=
self
.
employee_type
if
self
.
employee_type
else
''
if
self
.
github_username
:
result_node
[
User
.
USER_NODE_SLACK_ID
]
=
self
.
slack_id
if
self
.
slack_id
else
''
result_node
[
User
.
USER_NODE_GITHUB_NAME
]
=
self
.
github_username
result_node
[
User
.
USER_NODE_UPDATED_AT
]
=
self
.
updated_at
if
self
.
updated_at
else
0
if
self
.
team_name
:
result_node
[
User
.
USER_NODE_TEAM
]
=
self
.
team_name
if
self
.
employee_type
:
result_node
[
User
.
USER_NODE_EMPLOYEE_TYPE
]
=
self
.
employee_type
if
self
.
slack_id
:
result_node
[
User
.
USER_NODE_SLACK_ID
]
=
self
.
slack_id
if
self
.
updated_at
:
result_node
[
User
.
USER_NODE_UPDATED_AT
]
=
self
.
updated_at
return
[
result_node
]
return
[
result_node
]
...
...
setup.py
View file @
4af09d85
from
setuptools
import
setup
,
find_packages
from
setuptools
import
setup
,
find_packages
__version__
=
'1.0.
6
'
__version__
=
'1.0.
7
'
setup
(
setup
(
...
...
tests/unit/models/test_table_column_usage.py
View file @
4af09d85
...
@@ -11,9 +11,7 @@ class TestTableColumnUsage(unittest.TestCase):
...
@@ -11,9 +11,7 @@ class TestTableColumnUsage(unittest.TestCase):
# type: () -> None
# type: () -> None
col_readers
=
[
ColumnReader
(
database
=
'db'
,
cluster
=
'gold'
,
schema
=
'scm'
,
table
=
'foo'
,
column
=
'*'
,
col_readers
=
[
ColumnReader
(
database
=
'db'
,
cluster
=
'gold'
,
schema
=
'scm'
,
table
=
'foo'
,
column
=
'*'
,
user_email
=
'john@example.com'
),
user_email
=
'john@example.com'
)]
ColumnReader
(
database
=
'db'
,
cluster
=
'gold'
,
schema
=
'scm'
,
table
=
'bar'
,
column
=
'*'
,
user_email
=
'jane@example.com'
)]
table_col_usage
=
TableColumnUsage
(
col_readers
=
col_readers
)
table_col_usage
=
TableColumnUsage
(
col_readers
=
col_readers
)
node_row
=
table_col_usage
.
next_node
()
node_row
=
table_col_usage
.
next_node
()
...
@@ -22,14 +20,18 @@ class TestTableColumnUsage(unittest.TestCase):
...
@@ -22,14 +20,18 @@ class TestTableColumnUsage(unittest.TestCase):
actual
.
append
(
node_row
)
actual
.
append
(
node_row
)
node_row
=
table_col_usage
.
next_node
()
node_row
=
table_col_usage
.
next_node
()
expected
=
[{
'is_active'
:
True
,
expected
=
[{
'first_name'
:
''
,
'last_name'
:
''
,
'full_name'
:
''
,
'employee_type'
:
''
,
'is_active'
:
True
,
'updated_at'
:
0
,
'LABEL'
:
'User'
,
'LABEL'
:
'User'
,
'slack_id'
:
''
,
'KEY'
:
'john@example.com'
,
'KEY'
:
'john@example.com'
,
'email'
:
'john@example.com'
},
'github_username'
:
''
,
{
'is_active'
:
True
,
'team_name'
:
''
,
'LABEL'
:
'User'
,
'email'
:
'john@example.com'
}]
'KEY'
:
'jane@example.com'
,
'email'
:
'jane@example.com'
}]
self
.
assertEqual
(
expected
,
actual
)
self
.
assertEqual
(
expected
,
actual
)
rel_row
=
table_col_usage
.
next_relation
()
rel_row
=
table_col_usage
.
next_relation
()
...
@@ -39,9 +41,7 @@ class TestTableColumnUsage(unittest.TestCase):
...
@@ -39,9 +41,7 @@ class TestTableColumnUsage(unittest.TestCase):
rel_row
=
table_col_usage
.
next_relation
()
rel_row
=
table_col_usage
.
next_relation
()
expected
=
[{
'read_count:UNQUOTED'
:
1
,
'END_KEY'
:
'john@example.com'
,
'START_LABEL'
:
'Table'
,
expected
=
[{
'read_count:UNQUOTED'
:
1
,
'END_KEY'
:
'john@example.com'
,
'START_LABEL'
:
'Table'
,
'END_LABEL'
:
'User'
,
'START_KEY'
:
'db://gold.scm/foo'
,
'TYPE'
:
'READ_BY'
,
'REVERSE_TYPE'
:
'READ'
},
'END_LABEL'
:
'User'
,
'START_KEY'
:
'db://gold.scm/foo'
,
'TYPE'
:
'READ_BY'
,
'REVERSE_TYPE'
:
'READ'
}]
{
'read_count:UNQUOTED'
:
1
,
'END_KEY'
:
'jane@example.com'
,
'START_LABEL'
:
'Table'
,
'END_LABEL'
:
'User'
,
'START_KEY'
:
'db://gold.scm/bar'
,
'TYPE'
:
'READ_BY'
,
'REVERSE_TYPE'
:
'READ'
}]
self
.
assertEqual
(
expected
,
actual
)
self
.
assertEqual
(
expected
,
actual
)
...
...
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