Skip to content
Snippets Groups Projects
Commit 63fa402c authored by Tore.Brede's avatar Tore.Brede
Browse files

Fixing formatting

parent 3e7f3a7b
No related branches found
No related tags found
1 merge request!100Remove register endpoint
Pipeline #96468 passed
......@@ -9,19 +9,24 @@ from gregui.api.views.invitation import CreateInvitationView
@pytest.mark.django_db
def test_invite_guest(client, user_sponsor, unit_foo, role_type_foo):
data = {'first_name': 'Foo', 'last_name': 'Bar', 'email': 'test@example.com', 'role': {
'start_date': '2019-08-06',
'end_date': '2019-08-10',
'orgunit_id': unit_foo.id,
'type': role_type_foo.id
}}
url = reverse('gregui-v1:invite-create')
data = {
"first_name": "Foo",
"last_name": "Bar",
"email": "test@example.com",
"role": {
"start_date": "2019-08-06",
"end_date": "2019-08-10",
"orgunit_id": unit_foo.id,
"type": role_type_foo.id,
},
}
url = reverse("gregui-v1:invite-create")
all_persons = Person.objects.all()
assert len(all_persons) == 0
factory = APIRequestFactory()
request = factory.post(url, data, format='json')
request = factory.post(url, data, format="json")
force_authenticate(request, user=user_sponsor)
view = CreateInvitationView.as_view()
......@@ -32,5 +37,5 @@ def test_invite_guest(client, user_sponsor, unit_foo, role_type_foo):
all_persons = Person.objects.all()
assert len(all_persons) == 1
assert all_persons[0].first_name == 'Foo'
assert all_persons[0].last_name == 'Bar'
assert all_persons[0].first_name == "Foo"
assert all_persons[0].last_name == "Bar"
......@@ -35,12 +35,9 @@ def role_type_foo() -> RoleType:
@pytest.fixture
def sponsor_guy(unit_foo: OrganizationalUnit) -> Sponsor:
sponsor = Sponsor.objects.create(
feide_id="guy@example.org",
first_name="Sponsor",
last_name="Guy"
feide_id="guy@example.org", first_name="Sponsor", last_name="Guy"
)
sponsor.units.add(unit_foo,
through_defaults={"hierarchical_access": False})
sponsor.units.add(unit_foo, through_defaults={"hierarchical_access": False})
return Sponsor.objects.get(id=sponsor.id)
......@@ -50,10 +47,10 @@ def user_sponsor(sponsor_guy: Sponsor) -> User:
# Create a user and link him to a sponsor
user = user_model.objects.create(
username='test_sponsor',
email='test@example.org',
username="test_sponsor",
email="test@example.org",
first_name="Test",
last_name="Sponsor"
last_name="Sponsor",
)
GregUserProfile.objects.create(user=user, sponsor=sponsor_guy)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment