diff options
author | 2012-04-27 13:50:25 +0200 | |
---|---|---|
committer | 2012-05-27 19:54:29 +0200 | |
commit | 837c07729c089b8c5fdf3828cedff054b0cf1dde (patch) | |
tree | 3afcb0ab80782c22d74baeae803a369c8886eea0 /pygithub3/tests/services/test_issues.py | |
parent | Labels and Milestones services added (diff) | |
download | python-github3-837c07729c089b8c5fdf3828cedff054b0cf1dde.tar.xz python-github3-837c07729c089b8c5fdf3828cedff054b0cf1dde.zip |
test Label validation errors
Diffstat (limited to '')
-rw-r--r-- | pygithub3/tests/services/test_issues.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pygithub3/tests/services/test_issues.py b/pygithub3/tests/services/test_issues.py index 33ce754..4672bdb 100644 --- a/pygithub3/tests/services/test_issues.py +++ b/pygithub3/tests/services/test_issues.py @@ -4,6 +4,7 @@ import requests from mock import patch, Mock +from pygithub3.exceptions import ValidationError from pygithub3.tests.utils.core import TestCase from pygithub3.resources.base import json from pygithub3.services.issues import Issue, Comments, Events, Labels, Milestones @@ -133,12 +134,33 @@ class TestLabelsService(TestCase): self.assertEqual(request_method.call_args[0], ('post', _('repos/octocat/Hello-World/labels'))) + def test_CREATE_with_invalid_color(self, request_method): + request_method.return_value = mock_response('post') + # invalid color + with self.assertRaises(ValidationError): + args={'user': 'octocat', + 'repo': 'Hello-world', + 'name': 'bug', + 'color': 'FF00',} + self.lb.create(**args) + def test_UPDATE(self, request_method): request_method.return_value = mock_response('patch') self.lb.update('octocat', 'Hello-World', 'bug', 'critical', 'FF0000') self.assertEqual(request_method.call_args[0], ('patch', _('repos/octocat/Hello-World/labels/bug'))) + def test_UPDATE_with_invalid_color(self, request_method): + request_method.return_value = mock_response('post') + # invalid color + with self.assertRaises(ValidationError): + args={'user': 'octocat', + 'repo': 'Hello-world', + 'name': 'bug', + 'new_name': 'critical', + 'color': 'FF00',} + self.lb.update(**args) + def test_DELETE(self, request_method): request_method.return_value = mock_response('delete') self.lb.delete('octocat', 'Hello-World', 'bug') |