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 ...@@ -9,19 +9,24 @@ from gregui.api.views.invitation import CreateInvitationView
@pytest.mark.django_db @pytest.mark.django_db
def test_invite_guest(client, user_sponsor, unit_foo, role_type_foo): def test_invite_guest(client, user_sponsor, unit_foo, role_type_foo):
data = {'first_name': 'Foo', 'last_name': 'Bar', 'email': 'test@example.com', 'role': { data = {
'start_date': '2019-08-06', "first_name": "Foo",
'end_date': '2019-08-10', "last_name": "Bar",
'orgunit_id': unit_foo.id, "email": "test@example.com",
'type': role_type_foo.id "role": {
}} "start_date": "2019-08-06",
url = reverse('gregui-v1:invite-create') "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() all_persons = Person.objects.all()
assert len(all_persons) == 0 assert len(all_persons) == 0
factory = APIRequestFactory() factory = APIRequestFactory()
request = factory.post(url, data, format='json') request = factory.post(url, data, format="json")
force_authenticate(request, user=user_sponsor) force_authenticate(request, user=user_sponsor)
view = CreateInvitationView.as_view() view = CreateInvitationView.as_view()
...@@ -32,5 +37,5 @@ def test_invite_guest(client, user_sponsor, unit_foo, role_type_foo): ...@@ -32,5 +37,5 @@ def test_invite_guest(client, user_sponsor, unit_foo, role_type_foo):
all_persons = Person.objects.all() all_persons = Person.objects.all()
assert len(all_persons) == 1 assert len(all_persons) == 1
assert all_persons[0].first_name == 'Foo' assert all_persons[0].first_name == "Foo"
assert all_persons[0].last_name == 'Bar' assert all_persons[0].last_name == "Bar"
...@@ -35,12 +35,9 @@ def role_type_foo() -> RoleType: ...@@ -35,12 +35,9 @@ def role_type_foo() -> RoleType:
@pytest.fixture @pytest.fixture
def sponsor_guy(unit_foo: OrganizationalUnit) -> Sponsor: def sponsor_guy(unit_foo: OrganizationalUnit) -> Sponsor:
sponsor = Sponsor.objects.create( sponsor = Sponsor.objects.create(
feide_id="guy@example.org", feide_id="guy@example.org", first_name="Sponsor", last_name="Guy"
first_name="Sponsor",
last_name="Guy"
) )
sponsor.units.add(unit_foo, sponsor.units.add(unit_foo, through_defaults={"hierarchical_access": False})
through_defaults={"hierarchical_access": False})
return Sponsor.objects.get(id=sponsor.id) return Sponsor.objects.get(id=sponsor.id)
...@@ -50,10 +47,10 @@ def user_sponsor(sponsor_guy: Sponsor) -> User: ...@@ -50,10 +47,10 @@ def user_sponsor(sponsor_guy: Sponsor) -> User:
# Create a user and link him to a sponsor # Create a user and link him to a sponsor
user = user_model.objects.create( user = user_model.objects.create(
username='test_sponsor', username="test_sponsor",
email='test@example.org', email="test@example.org",
first_name="Test", first_name="Test",
last_name="Sponsor" last_name="Sponsor",
) )
GregUserProfile.objects.create(user=user, sponsor=sponsor_guy) 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