diff options
author | 2012-04-27 13:50:25 +0200 | |
---|---|---|
committer | 2012-05-27 19:54:29 +0200 | |
commit | 837c07729c089b8c5fdf3828cedff054b0cf1dde (patch) | |
tree | 3afcb0ab80782c22d74baeae803a369c8886eea0 /pygithub3/requests/issues/labels.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 'pygithub3/requests/issues/labels.py')
-rw-r--r-- | pygithub3/requests/issues/labels.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/pygithub3/requests/issues/labels.py b/pygithub3/requests/issues/labels.py index 47337f9..75e11e4 100644 --- a/pygithub3/requests/issues/labels.py +++ b/pygithub3/requests/issues/labels.py @@ -18,11 +18,13 @@ class Create(Request): 'required': ('name', 'color' ) } - def validate_color(color): - color = color.get('color', '') + def clean_body(self): + color = self.body.get('color', '') if not Label.is_valid_color(color): raise ValidationError('colors must have 6 hexadecimal characters, ' 'without # in the beggining') + else: + return self.body class Update(Request): @@ -33,12 +35,13 @@ class Update(Request): 'schema': ('name', 'color'), 'required': ('name', 'color' ) } - - def validate_color(color): - color = color.get('color', '') + def clean_body(self): + color = self.body.get('color', '') if not Label.is_valid_color(color): raise ValidationError('colors must have 6 hexadecimal characters, ' 'without # in the beggining') + else: + return self.body class Delete(Request): @@ -61,6 +64,7 @@ class Add_to_issue(Request): uri = 'repos/{user}/{repo}/issues/{number}/labels' resource = Label + class Remove_from_issue(Request): uri = 'repos/{user}/{repo}/issues/{number}/labels/{name}' resource = Label |