Example #1
0
 def test_accepts_valid_input(self, pyramid_csrf_request):
     schema = EditProfileSchema().bind(request=pyramid_csrf_request)
     schema.deserialize({
         "display_name": "Michael Granitzer",
         "description": "Professor at University of Passau",
         "link": "http://mgrani.github.io/",
         "location": "Bavaria, Germany",
         "orcid": "0000-0003-3566-5507",
     })
Example #2
0
 def test_accepts_valid_input(self, pyramid_csrf_request):
     schema = EditProfileSchema().bind(request=pyramid_csrf_request)
     schema.deserialize({
         'display_name': 'Michael Granitzer',
         'description': 'Professor at University of Passau',
         'link': 'http://mgrani.github.io/',
         'location': 'Bavaria, Germany',
         'orcid': '0000-0003-3566-5507',
     })
Example #3
0
 def test_accepts_valid_input(self, pyramid_csrf_request):
     schema = EditProfileSchema().bind(request=pyramid_csrf_request)
     schema.deserialize(
         {
             "display_name": "Michael Granitzer",
             "description": "Professor at University of Passau",
             "link": "http://mgrani.github.io/",
             "location": "Bavaria, Germany",
             "orcid": "0000-0003-3566-5507",
         }
     )
Example #4
0
 def __init__(self, request):
     self.request = request
     self.schema = EditProfileSchema().bind(request=self.request)
     self.form = request.create_form(self.schema,
                                     buttons=(_("Save"), ),
                                     use_inline_editing=True)
Example #5
0
 def test_rejects_invalid_url(self, pyramid_csrf_request, validate_url):
     validate_url.side_effect = ValueError("Invalid URL")
     schema = EditProfileSchema().bind(request=pyramid_csrf_request)
     with pytest.raises(colander.Invalid) as exc:
         schema.deserialize({"link": '"invalid URL"'})
     assert exc.value.asdict()["link"] == "Invalid URL"
Example #6
0
 def test_rejects_invalid_orcid(self, pyramid_csrf_request, validate_orcid):
     validate_orcid.side_effect = ValueError("Invalid ORCID")
     schema = EditProfileSchema().bind(request=pyramid_csrf_request)
     with pytest.raises(colander.Invalid) as exc:
         schema.deserialize({"orcid": "abcdef"})
     assert exc.value.asdict()["orcid"] == "Invalid ORCID"
Example #7
0
 def test_rejects_invalid_url(self, pyramid_csrf_request, validate_url):
     validate_url.side_effect = ValueError("Invalid URL")
     schema = EditProfileSchema().bind(request=pyramid_csrf_request)
     with pytest.raises(colander.Invalid) as exc:
         schema.deserialize({"link": '"invalid URL"'})
     assert exc.value.asdict()["link"] == "Invalid URL"
Example #8
0
 def test_rejects_invalid_orcid(self, pyramid_csrf_request, validate_orcid):
     validate_orcid.side_effect = ValueError("Invalid ORCID")
     schema = EditProfileSchema().bind(request=pyramid_csrf_request)
     with pytest.raises(colander.Invalid) as exc:
         schema.deserialize({"orcid": "abcdef"})
     assert exc.value.asdict()["orcid"] == "Invalid ORCID"