Skip to content

Commit

Permalink
Refactored contact us tests
Browse files Browse the repository at this point in the history
Co-authored-by: Eduardo <eduardolimrib@gmail.com>
  • Loading branch information
Lucas362 and eilimrib committed Jun 15, 2018
1 parent 272dd78 commit ed24e86
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,43 +263,3 @@ def test_invalid_partial_update_social(self):
"Date has wrong format. Use one of these formats instead: YYYY[-MM[-DD]]."
]}
)

class ContactUsTests(APITestCase):

def setUp(self):
"""
This method will run before any test.
"""
self.contactUs = ContactUs.objects.create(
topic='teste',
email='email@email.com',
choice='A',
text='teste'
)
self.url = '/api/contact_us/'

def tearDown(self):
"""
This method will run after any test.
"""
self.contactUs.delete()

def test_create_contact_us(self):
"""
Ensure we can create a 'contact us' object.
"""
response = self.client.get(self.url + str(self.contactUs.pk) + '/')
self.assertEqual(response.status_code, status.HTTP_200_OK)

def test_invalid_create_contact_us(self):
"""
Ensure we can't create a invalid user object.
"""
data = {
'topic':'updated',
'email':'just@testing.com',
'choice':'teste',
'text':'teste'
}
response = self.client.post(self.url, data)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)

0 comments on commit ed24e86

Please sign in to comment.