Skip to content

Commit

Permalink
Add test cases.
Browse files Browse the repository at this point in the history
JIRA: PDC-1101
  • Loading branch information
simozhan committed Oct 20, 2015
1 parent 9186fda commit 253a33d
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions pdc/apps/package/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,34 @@ def test_query_compose(self):
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data.get('count'), 3)

def test_query_disc_number_with_wrong_value(self):
key = 'disc_number'
value = 'wrongvalue'
response = self.client.get(reverse('image-list'), {key: value})
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
self.assertEqual(response.data, {"detail": [u'Value [%s] of %s is not an integer' % (value, key)]})

def test_query_disc_count_with_wrong_value(self):
key = 'disc_count'
value = 'wrongvalue'
response = self.client.get(reverse('image-list'), {key: value})
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
self.assertEqual(response.data, {"detail": [u'Value [%s] of %s is not an integer' % (value, key)]})

def test_query_mtime_with_wrong_value(self):
key = 'mtime'
value = 'wrongvalue'
response = self.client.get(reverse('image-list'), {key: value})
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
self.assertEqual(response.data, {"detail": [u'Value [%s] of %s is not an integer' % (value, key)]})

def test_query_size_with_wrong_value(self):
key = 'size'
value = 'wrongvalue'
response = self.client.get(reverse('image-list'), {key: value})
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
self.assertEqual(response.data, {"detail": [u'Value [%s] of %s is not an integer' % (value, key)]})


class BuildImageRESTTestCase(TestCaseWithChangeSetMixin, APITestCase):
fixtures = [
Expand Down

0 comments on commit 253a33d

Please sign in to comment.