Exemplo n.º 1
0
 def test_name_validation(self):
     r = self.api_get('/rest/p/test/')
     assert r.status_int == 200
     with mock.patch(
             'allura.lib.plugin.ProjectRegistrationProvider') as Provider:
         Provider.get().shortname_validator.to_python.side_effect = Invalid(
             'name', 'value', {})
         r = self.api_get('/rest/p/test/', status=404)
Exemplo n.º 2
0
def test_subproject():
    project = M.Project.query.get(shortname='test')
    with td.raises(ToolError):
        with patch(
                'allura.lib.plugin.ProjectRegistrationProvider') as Provider:
            Provider.get().shortname_validator.to_python.side_effect = Invalid(
                'name', 'value', {})
            # name doesn't validate
            sp = project.new_subproject('test-proj-nose')
    sp = project.new_subproject('test-proj-nose')
    spp = sp.new_subproject('spp')
    ThreadLocalORMSession.flush_all()
    sp.delete()
    ThreadLocalORMSession.flush_all()