def test_api_create_invalid_membership_no_email_no_user(client):
 user = f.UserFactory.create()
 role = f.RoleFactory.create()
 client.login(role.project.owner)
 url = reverse('memberships-list')
 data = {'role': role.pk, 'project': role.project.pk}
 response = client.json.post(url, json.dumps(data))
 assert (response.status_code == 400), response.data
 assert (user.memberships.count() == 0)

def test_api_create_invalid_membership_no_email_no_user ( client ) : user = f . UserFactory . create ( ) role = f . RoleFactory . create ( ) client . login ( role . project . owner ) url = reverse ( 'memberships-list' ) data = { 'role' : role . pk , 'project' : role . project . pk } response = client . json . post ( url , json . dumps ( data ) ) assert ( response . status_code == 400 ) , response . data assert ( user . memberships . count ( ) == 0 )
should not create the invitation linked to that user .