Skip to content

Commit

Permalink
fix: Missing date of birth in people export
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Jul 21, 2020
1 parent 7097515 commit 434a3f4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
22 changes: 20 additions & 2 deletions backend/atlas/queries/test_users.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from datetime import date

import pytest

from atlas.models import Profile, User
import pytest

BASE_QUERY = """
query listUsers(
Expand Down Expand Up @@ -131,6 +130,25 @@ def test_users_shows_reports(gql_client, default_user, other_user):
]


def test_users_shows_date_of_birth(gql_client, default_user, other_user):
executed = gql_client.execute(
"""{users(id:"%s") {
results { dateOfBirth }
}}"""
% (str(default_user.id)),
user=default_user,
)
result = executed["data"]["users"]
assert len(result["results"]) == 1
assert result["results"] == [
{
"dateOfBirth": default_user.profile.date_of_birth.replace(
year=1900
).isoformat()
}
]


def test_users_shows_self_email(gql_client, default_user):
executed = gql_client.execute(BASE_QUERY, user=default_user)
result = executed["data"]["users"]
Expand Down
11 changes: 5 additions & 6 deletions backend/conftest.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from datetime import date
from uuid import UUID

import graphene.test
import pytest
from django.conf import settings
from django.contrib.auth.models import AnonymousUser

from atlas import factories
from atlas.root_schema import schema
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
import graphene.test
import pytest


def pytest_configure(config):
Expand Down Expand Up @@ -93,7 +92,7 @@ def default_user(db, design_department, default_team):
user=user,
title="Dummy",
date_started=date(2010, 4, 26),
date_of_birth=date(1900, 8, 12),
date_of_birth=date(1920, 8, 12),
department=design_department,
team=default_team,
office=None,
Expand Down
1 change: 1 addition & 0 deletions frontend/src/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ export const EXPORT_PEOPLE_QUERY = gql`
isDirectoryHidden
title
dateStarted
dateOfBirth
reportsTo {
email
}
Expand Down

0 comments on commit 434a3f4

Please sign in to comment.