Project

General

Profile

« Previous | Next » 

Revision 721bd8e5

Added by Frédéric Péters (de retour le 27 mai) over 1 year ago

misc: remove custom myspace page (#72820)

View differences:

tests/test_user_pages.py
69 69
    user = create_user()
70 70
    app = login(get_app(pub), username='user', password='user')
71 71
    resp = app.get('/', status=200)
72
    resp = app.get('/myspace/', status=200)
73

  
74

  
75
def test_myspace_with_user_forms():
76
    user = create_user()
77
    formdef = create_formdef()
78

  
79
    cat = Category(name='cat')
80
    cat.store()
81
    formdef.category_id = cat.id
82
    formdef.enable_tracking_codes = True
83

  
84
    wf = Workflow(name='status')
85
    st1 = wf.add_status('Status1', 'st1')
86
    wf.store()
87
    formdef.workflow_id = wf.id
88
    formdef.store()
89

  
90
    formdef.data_class().wipe()
91
    formdata = formdef.data_class()()
92
    formdata.user_id = user.id
93
    formdata.status = 'wf-st1'
94
    formdata.receipt_time = time.localtime()
95
    formdata.data = {}
96
    formdata.store()
97
    draft = formdef.data_class()()
98
    draft.user_id = user.id
99
    draft.status = 'draft'
100
    draft.receipt_time = time.localtime()
101
    draft.data = {}
102
    draft.store()
103

  
104
    app = login(get_app(pub), username='user', password='user')
105
    resp = app.get('/myspace/')
106
    assert formdata.id != draft.id
107
    assert '<a href="/test/%s/"' % formdata.id in resp
108
    assert '<a href="/test/%s/"' % draft.id in resp
109
    resp = app.get('/test/%s/' % formdata.id, status=302)
110
    assert resp.location == 'http://example.net/cat/test/%s/' % formdata.id
111
    resp = app.get('/test/%s/' % draft.id, status=302)
112
    resp = resp.follow(status=302)
113
    assert resp.location.startswith('http://example.net/cat/test/?mt=')
114
    resp = resp.follow(status=200)
115

  
116
    # disable formdef: formdatas are still visible and accessible, drafts are not
117
    formdef.disabled = True
118
    formdef.store()
119
    resp = app.get('/myspace/')
120
    assert formdata.id != draft.id
121
    assert '<a href="/test/%s/"' % formdata.id in resp
122
    assert not '<a href="/test/%s"' % draft.id in resp
123
    resp = app.get('/cat/test/%s' % formdata.id)
124
    resp.status_int = 200
125
    resp = app.get('/cat/test/%s/' % draft.id, status=302)
126
    resp = resp.follow(status=403)
127 72

  
128 73

  
129 74
def test_form_category_redirection():

Also available in: Unified diff