Beispiel #1
0
 def test_contact_organisation_relationship(self):
     test_org_name = 'Test Organisation'
     test_org = Organisation.create(name=test_org_name, type='charity')
     test_contact = Contact.create(first_name='test', last_name='contact', email='*****@*****.**',
                                   org_id=test_org.id)
     self.assertEquals(test_org.id, test_contact.org_id)
     self.assertEquals(len(test_org.contacts), 1)
     self.assertEquals(test_contact.organisation.name, test_org_name)
Beispiel #2
0
 def test_contact_organisation_relationship(self):
     test_org_name = 'Test Organisation'
     test_org = Organisation.create(name=test_org_name, type='charity')
     test_contact = Contact.create(first_name='test',
                                   last_name='contact',
                                   email='*****@*****.**',
                                   org_id=test_org.id)
     self.assertEqual(test_org.id, test_contact.org_id)
     self.assertEqual(len(test_org.contacts), 1)
     self.assertEqual(test_contact.organisation.name, test_org_name)
Beispiel #3
0
 def test_view_contact_route(self):
     org_data = {
         'name': 'test charity',
         'type': 'charity',
         'address': '1 My Road, London'
     }
     o = Organisation.create(**org_data)
     con_data = {
         'first_name': 'test',
         'last_name': 'contact',
         'email': '*****@*****.**',
         'org_id': o.id
     }
     self.client.post('/contact/create', data=con_data)
     c = Contact.query.filter_by(email=con_data['email']).first()
     rv = self.client.get('/contact/{}'.format(c.id))
     self.assertEquals(rv.status_code, 200)
Beispiel #4
0
 def test_view_contact_route(self):
     org_data = {
         'name': 'test charity',
         'type': 'charity',
         'address': '1 My Road, London'
     }
     o = Organisation.create(**org_data)
     con_data = {
         'first_name': 'test',
         'last_name': 'contact',
         'email': '*****@*****.**',
         'org_id': o.id
     }
     self.client.post('/contact/create', data=con_data)
     c = Contact.query.filter_by(email=con_data['email']).first()
     rv = self.client.get('/contact/{}'.format(c.id))
     self.assertEquals(rv.status_code, 200)
Beispiel #5
0
 def test_create_contact_valid_form(self):
     org_data = {
         'name': 'test charity',
         'type': 'charity',
         'address': '1 My Road, London'
     }
     o = Organisation.create(**org_data)
     data = {
         'first_name': 'test',
         'last_name': 'contact',
         'email': '*****@*****.**',
         'org_id': o.id
     }
     rv = self.client.post('/contact/create', data=data)
     self.assertEquals(rv.status_code, 302)
     c = Contact.query.filter_by(email=data['email']).all()
     self.assertEqual(len(c), 1)
     self.assertEqual(c[0].first_name, data['first_name'])
     self.assertEqual(c[0].last_name, data['last_name'])
     self.assertEqual(c[0].email, data['email'])
Beispiel #6
0
 def test_create_contact_valid_form(self):
     org_data = {
         'name': 'test charity',
         'type': 'charity',
         'address': '1 My Road, London'
     }
     o = Organisation.create(**org_data)
     data = {
         'first_name': 'test',
         'last_name': 'contact',
         'email': '*****@*****.**',
         'org_id': o.id
     }
     rv = self.client.post('/contact/create', data=data)
     self.assertEquals(rv.status_code, 302)
     c = Contact.query.filter_by(email=data['email']).all()
     self.assertEqual(len(c), 1)
     self.assertEqual(c[0].first_name, data['first_name'])
     self.assertEqual(c[0].last_name, data['last_name'])
     self.assertEqual(c[0].email, data['email'])