92
92
svntest.main.file_write(authz_path, authz_content)
95
svntest.actions.run_and_verify_svnauthz("Valid authz file", None, None,
95
svntest.actions.run_and_verify_svnauthz(None, None,
96
96
0, False, "validate", authz_path)
98
98
# Invalid authz file, expect exit code 1, we found the file loaded it
99
99
# but found an error
100
100
svntest.main.file_write(authz_path, 'x\n')
101
svntest.actions.run_and_verify_svnauthz("Invalid authz file", None, None,
101
svntest.actions.run_and_verify_svnauthz(None, None,
102
102
1, False, "validate", authz_path)
104
# Non-existant authz file
104
# Non-existent authz file
105
105
# exit code 2, operational error since we can't test the file.
106
106
os.close(authz_fd)
107
107
os.remove(authz_path)
108
svntest.actions.run_and_verify_svnauthz("Non-existant authz file", None,
108
svntest.actions.run_and_verify_svnauthz(None,
109
109
None, 2, False, "validate",
128
128
expected_status.add({
129
129
'A/authz' : Item(status=' ', wc_rev=2),
131
if svntest.actions.run_and_verify_commit(wc_dir, expected_output,
132
expected_status, None, wc_dir):
133
raise svntest.Failure
131
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
135
134
# Valid authz url (file stored in repo)
136
135
authz_url = repo_url + '/A/authz'
137
svntest.actions.run_and_verify_svnauthz("Valid authz url", None, None,
136
svntest.actions.run_and_verify_svnauthz(None, None,
138
137
0, False, "validate", authz_url)
140
139
# Invalid authz url (again use the iota file in the repo)
141
140
# expect exit code 1, we found the file loaded it but found an error
142
141
iota_url = repo_url + '/iota'
143
svntest.actions.run_and_verify_svnauthz("Invalid authz url", None, None,
142
svntest.actions.run_and_verify_svnauthz(None, None,
144
143
1, False, "validate", iota_url)
146
# Non-existant authz url
145
# Non-existent authz url
147
146
# exit code 2, operational error since we can't test the file.
148
svntest.actions.run_and_verify_svnauthz("Non-existant authz file", None,
147
svntest.actions.run_and_verify_svnauthz(None,
149
148
None, 2, False, "validate",
150
149
repo_url + "/zilch")
220
217
# Anonymous access with no path, and no repository should be rw
221
218
# since it returns the highest level of access granted anywhere.
222
219
# So /bios being rw for everyone means this will be rw.
223
svntest.actions.run_and_verify_svnauthz("Anonymous access", ["rw\n"], None,
220
svntest.actions.run_and_verify_svnauthz(["rw\n"], None,
224
221
0, False, "accessof", authz_path)
226
223
# Anonymous access on /jokes should be r, no repo so won't match
227
224
# the slapstick:/jokes section.
228
svntest.actions.run_and_verify_svnauthz("Anonymous access on path",
229
["r\n"], None, 0, False, "accessof",
225
svntest.actions.run_and_verify_svnauthz(["r\n"], None, 0, False, "accessof",
230
226
authz_path, "--path", "/jokes")
232
228
# Anonymous access on /jokes on slapstick repo should be no
233
svntest.actions.run_and_verify_svnauthz("Anonymous access on path with repo",
234
["no\n"], None, 0, False, "accessof",
229
svntest.actions.run_and_verify_svnauthz(["no\n"], None, 0, False, "accessof",
235
230
authz_path, "--path", "/jokes",
236
231
"--repository", "slapstick")
238
233
# User access with no path, and no repository should be rw
239
234
# since it returns the h ighest level of access anywhere.
240
235
# So /bios being rw for everyone means this will be rw.
241
svntest.actions.run_and_verify_svnauthz("User access", ["rw\n"], None,
236
svntest.actions.run_and_verify_svnauthz(["rw\n"], None,
242
237
0, False, "accessof", authz_path,
243
238
"--username", "groucho")
245
240
# User groucho specified on /jokes with no repo, will not match any of the
246
241
# repo specific sections, so is r since everyone has read access.
247
svntest.actions.run_and_verify_svnauthz("User access on path", ["r\n"], None,
242
svntest.actions.run_and_verify_svnauthz(["r\n"], None,
248
243
0, False, "accessof", authz_path,
249
244
"--path", "/jokes", "--username",
252
247
# User groucho specified on /jokes with the repo comedy will be rw
253
svntest.actions.run_and_verify_svnauthz("User access on path with repo",
254
["rw\n"], None, 0, False, "accessof",
248
svntest.actions.run_and_verify_svnauthz(["rw\n"], None, 0, False, "accessof",
255
249
authz_path, "--path", "/jokes",
256
250
"--username", "groucho",
257
251
"--repository", "comedy")
282
276
'A/authz' : Item(status=' ', wc_rev=2),
284
278
if svntest.actions.run_and_verify_commit(wc_dir, expected_output,
285
expected_status, None, wc_dir):
286
280
raise svntest.Failure
288
282
# Anonymous access with no path, and no repository should be rw
289
283
# since it returns the highest level of access granted anywhere.
290
284
# So /bios being rw for everyone means this will be rw.
291
285
authz_url = repo_url + "/A/authz"
292
svntest.actions.run_and_verify_svnauthz("Anonymous access", ["rw\n"], None,
286
svntest.actions.run_and_verify_svnauthz(["rw\n"], None,
293
287
0, False, "accessof", authz_url)
295
289
# Anonymous access on /jokes should be r, no repo so won't match
296
290
# the slapstick:/jokes section.
297
svntest.actions.run_and_verify_svnauthz("Anonymous access on path",
298
["r\n"], None, 0, False, "accessof",
291
svntest.actions.run_and_verify_svnauthz(["r\n"], None, 0, False, "accessof",
299
292
authz_url, "--path", "/jokes")
301
294
# Anonymous access on /jokes on slapstick repo should be no
302
svntest.actions.run_and_verify_svnauthz("Anonymous access on path with repo",
303
["no\n"], None, 0, False, "accessof",
295
svntest.actions.run_and_verify_svnauthz(["no\n"], None, 0, False, "accessof",
304
296
authz_url, "--path", "/jokes",
305
297
"--repository", "slapstick")
307
299
# User access with no path, and no repository should be rw
308
300
# since it returns the h ighest level of access anywhere.
309
301
# So /bios being rw for everyone means this will be rw.
310
svntest.actions.run_and_verify_svnauthz("User access", ["rw\n"], None,
302
svntest.actions.run_and_verify_svnauthz(["rw\n"], None,
311
303
0, False, "accessof", authz_url,
312
304
"--username", "groucho")
314
306
# User groucho specified on /jokes with no repo, will not match any of the
315
307
# repo specific sections, so is r since everyone has read access.
316
svntest.actions.run_and_verify_svnauthz("User access on path", ["r\n"], None,
308
svntest.actions.run_and_verify_svnauthz(["r\n"], None,
317
309
0, False, "accessof", authz_url,
318
310
"--path", "/jokes", "--username",
321
313
# User groucho specified on /jokes with the repo comedy will be rw
322
svntest.actions.run_and_verify_svnauthz("User access on path with repo",
323
["rw\n"], None, 0, False, "accessof",
314
svntest.actions.run_and_verify_svnauthz(["rw\n"], None, 0, False, "accessof",
324
315
authz_url, "--path", "/jokes",
325
316
"--username", "groucho",
326
317
"--repository", "comedy")
342
333
# Anonymous access with no path, and no repository should be no
343
334
# since it returns the highest level of access granted anywhere.
344
svntest.actions.run_and_verify_svnauthz("Anonymous access", ["no\n"], None,
335
svntest.actions.run_and_verify_svnauthz(["no\n"], None,
345
336
0, False, "accessof", authz_path,
346
337
"--groups-file", groups_path)
348
339
# User stafford (@musicians) access with no path, and no repository should
349
340
# be no since it returns the highest level of access granted anywhere.
350
svntest.actions.run_and_verify_svnauthz("Group 1 access",
341
svntest.actions.run_and_verify_svnauthz(["rw\n"], None,
352
342
0, False, "accessof", authz_path,
353
343
"--groups-file", groups_path,
354
344
"--username", "stafford")
356
346
# User groucho (@comedians) access with no path, and no repository should
357
347
# be no since it returns the highest level of access granted anywhere.
358
svntest.actions.run_and_verify_svnauthz("Group 2 access",
348
svntest.actions.run_and_verify_svnauthz(["no\n"], None,
360
349
0, False, "accessof", authz_path,
361
350
"--groups-file", groups_path,
362
351
"--username", "groucho")
364
353
# Anonymous access specified on /jokes with the repo comedy will be no.
365
svntest.actions.run_and_verify_svnauthz("Anonymous access on path with repo",
366
["no\n"], None, 0, False,
354
svntest.actions.run_and_verify_svnauthz(["no\n"], None, 0, False,
367
355
"accessof", authz_path,
368
356
"--groups-file", groups_path,
369
357
"--path", "jokes",
423
409
'A/groups' : Item(status=' ', wc_rev=2),
426
if svntest.actions.run_and_verify_commit(wc_dir, expected_output,
427
expected_status, None, wc_dir):
428
raise svntest.Failure
412
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
430
415
# Anonymous access with no path, and no repository should be no
431
416
# since it returns the highest level of access granted anywhere.
432
417
authz_url = repo_url + "/A/authz"
433
418
groups_url = repo_url + "/A/groups"
434
svntest.actions.run_and_verify_svnauthz("Anonymous access", ["no\n"], None,
419
svntest.actions.run_and_verify_svnauthz(["no\n"], None,
435
420
0, False, "accessof", authz_url,
436
421
"--groups-file", groups_url)
438
423
# User stafford (@musicians) access with no path, and no repository should
439
424
# be no since it returns the highest level of access granted anywhere.
440
svntest.actions.run_and_verify_svnauthz("Group 1 access",
425
svntest.actions.run_and_verify_svnauthz(["rw\n"], None,
442
426
0, False, "accessof", authz_url,
443
427
"--groups-file", groups_url,
444
428
"--username", "stafford")
446
430
# User groucho (@comedians) access with no path, and no repository should
447
431
# be no since it returns the highest level of access granted anywhere.
448
svntest.actions.run_and_verify_svnauthz("Group 2 access",
432
svntest.actions.run_and_verify_svnauthz(["no\n"], None,
450
433
0, False, "accessof", authz_url,
451
434
"--groups-file", groups_url,
452
435
"--username", "groucho")
454
437
# Anonymous access specified on /jokes with the repo comedy will be no.
455
svntest.actions.run_and_verify_svnauthz("Anonymous access on path with repo",
456
["no\n"], None, 0, False,
438
svntest.actions.run_and_verify_svnauthz(["no\n"], None, 0, False,
457
439
"accessof", authz_url,
458
440
"--groups-file", groups_url,
459
441
"--path", "jokes",
503
483
# since it returns the highest level of access granted anywhere.
504
484
# So /bios being rw for everyone means this will be rw.
505
485
# Test --is rw returns 0.
506
svntest.actions.run_and_verify_svnauthz("Anonymous access --is rw", None,
486
svntest.actions.run_and_verify_svnauthz(None,
507
487
None, 0, False, "accessof",
508
488
authz_path, "--is", "rw")
509
489
# Test --is r returns 3.
510
svntest.actions.run_and_verify_svnauthz("Anonymous access --is r", None,
490
svntest.actions.run_and_verify_svnauthz(None,
511
491
None, 3, False, "accessof",
512
492
authz_path, "--is", "r")
513
493
# Test --is no returns 3.
514
svntest.actions.run_and_verify_svnauthz("Anonymous access --is no", None,
494
svntest.actions.run_and_verify_svnauthz(None,
515
495
None, 3, False, "accessof",
516
496
authz_path, "--is", "no")
518
498
# Anonymous access on /jokes should be r, no repo so won't match
519
499
# the slapstick:/jokes section.
520
500
# Test --is r returns 0.
521
svntest.actions.run_and_verify_svnauthz("Anonymous access on path --is r",
522
None, None, 0, False, "accessof",
501
svntest.actions.run_and_verify_svnauthz(None, None, 0, False, "accessof",
523
502
authz_path, "--path", "/jokes",
525
504
# Test --is rw returns 3.
526
svntest.actions.run_and_verify_svnauthz("Anonymous access on path --is r",
527
None, None, 3, False, "accessof",
505
svntest.actions.run_and_verify_svnauthz(None, None, 3, False, "accessof",
528
506
authz_path, "--path", "/jokes",
530
508
# Test --is no returns 3.
531
svntest.actions.run_and_verify_svnauthz("Anonymous access on path --is r",
532
None, None, 3, False, "accessof",
509
svntest.actions.run_and_verify_svnauthz(None, None, 3, False, "accessof",
533
510
authz_path, "--path", "/jokes",
536
513
# Anonymous access on /jokes on slapstick repo should be no
537
514
# Test --is no returns 0.
538
svntest.actions.run_and_verify_svnauthz("Anon access on path w/ repo --is no",
539
None, None, 0, False, "accessof",
515
svntest.actions.run_and_verify_svnauthz(None, None, 0, False, "accessof",
540
516
authz_path, "--path", "/jokes",
541
517
"--repository", "slapstick",
543
519
# Test --is rw returns 3.
544
svntest.actions.run_and_verify_svnauthz("Anon access on path w/ repo --is no",
545
None, None, 3, False, "accessof",
520
svntest.actions.run_and_verify_svnauthz(None, None, 3, False, "accessof",
546
521
authz_path, "--path", "/jokes",
547
522
"--repository", "slapstick",
549
524
# Test --is r returns 3.
550
svntest.actions.run_and_verify_svnauthz("Anon access on path w/ repo --is no",
551
None, None, 3, False, "accessof",
525
svntest.actions.run_and_verify_svnauthz(None, None, 3, False, "accessof",
552
526
authz_path, "--path", "/jokes",
553
527
"--repository", "slapstick",
557
531
# since it returns the h ighest level of access anywhere.
558
532
# So /bios being rw for everyone means this will be rw.
559
533
# Test --is rw returns 0.
560
svntest.actions.run_and_verify_svnauthz("User access --is rw", None, None,
534
svntest.actions.run_and_verify_svnauthz(None, None,
561
535
0, False, "accessof", authz_path,
562
536
"--username", "groucho", "--is",
564
538
# Test --is r returns 3.
565
svntest.actions.run_and_verify_svnauthz("User access --is r", None, None,
539
svntest.actions.run_and_verify_svnauthz(None, None,
566
540
3, False, "accessof", authz_path,
567
541
"--username", "groucho", "--is",
569
543
# Test --is no returns 3.
570
svntest.actions.run_and_verify_svnauthz("User access --is no", None, None,
544
svntest.actions.run_and_verify_svnauthz(None, None,
571
545
3, False, "accessof", authz_path,
572
546
"--username", "groucho", "--is",
575
549
# User groucho specified on /jokes with no repo, will not match any of the
576
550
# repo specific sections, so is r since everyone has read access.
577
551
# Test --is r returns 0.
578
svntest.actions.run_and_verify_svnauthz("User access on path --is r", None,
552
svntest.actions.run_and_verify_svnauthz(None,
579
553
None, 0, False, "accessof",
580
554
authz_path, "--path", "/jokes",
581
555
"--username", "groucho", "--is", "r")
582
556
# Test --is rw returns 3.
583
svntest.actions.run_and_verify_svnauthz("User access on path --is rw", None,
557
svntest.actions.run_and_verify_svnauthz(None,
584
558
None, 3, False, "accessof",
585
559
authz_path, "--path", "/jokes",
586
560
"--username", "groucho",
588
562
# Test --is no returns 3.
589
svntest.actions.run_and_verify_svnauthz("User access on path --is no", None,
563
svntest.actions.run_and_verify_svnauthz(None,
590
564
None, 3, False, "accessof",
591
565
authz_path, "--path", "/jokes",
592
566
"--username", "groucho",
595
569
# User groucho specified on /jokes with the repo comedy will be rw
596
570
# Test --is rw returns 0.
597
svntest.actions.run_and_verify_svnauthz("User access on path w/ repo --is rw",
598
None, None, 0, False, "accessof",
571
svntest.actions.run_and_verify_svnauthz(None, None, 0, False, "accessof",
599
572
authz_path, "--path", "/jokes",
600
573
"--username", "groucho",
601
574
"--repository", "comedy", "--is",
603
576
# Test --is r returns 3.
604
svntest.actions.run_and_verify_svnauthz("User access on path w/ repo --is r",
605
None, None, 3, False, "accessof",
577
svntest.actions.run_and_verify_svnauthz(None, None, 3, False, "accessof",
606
578
authz_path, "--path", "/jokes",
607
579
"--username", "groucho",
608
580
"--repository", "comedy", "--is",
610
582
# Test --is no returns 3.
611
svntest.actions.run_and_verify_svnauthz("User access on path w/ repo --is no",
612
None, None, 3, False, "accessof",
583
svntest.actions.run_and_verify_svnauthz(None, None, 3, False, "accessof",
613
584
authz_path, "--path", "/jokes",
614
585
"--username", "groucho",
615
586
"--repository", "comedy", "--is",
672
641
# since it returns the highest level of access granted anywhere.
673
642
# So /bios being rw for everyone means this will be rw.
674
643
# Test --is rw returns 0.
675
svntest.actions.run_and_verify_svnauthz("Anonymous access --is rw", None,
644
svntest.actions.run_and_verify_svnauthz(None,
676
645
None, 0, False, "accessof",
677
646
authz_url, "--is", "rw")
678
647
# Test --is r returns 3.
679
svntest.actions.run_and_verify_svnauthz("Anonymous access --is r", None,
648
svntest.actions.run_and_verify_svnauthz(None,
680
649
None, 3, False, "accessof",
681
650
authz_url, "--is", "r")
682
651
# Test --is no returns 3.
683
svntest.actions.run_and_verify_svnauthz("Anonymous access --is no", None,
652
svntest.actions.run_and_verify_svnauthz(None,
684
653
None, 3, False, "accessof",
685
654
authz_url, "--is", "no")
687
656
# Anonymous access on /jokes should be r, no repo so won't match
688
657
# the slapstick:/jokes section.
689
658
# Test --is r returns 0.
690
svntest.actions.run_and_verify_svnauthz("Anonymous access on path --is r",
691
None, None, 0, False, "accessof",
659
svntest.actions.run_and_verify_svnauthz(None, None, 0, False, "accessof",
692
660
authz_url, "--path", "/jokes",
694
662
# Test --is rw returns 3.
695
svntest.actions.run_and_verify_svnauthz("Anonymous access on path --is r",
696
None, None, 3, False, "accessof",
663
svntest.actions.run_and_verify_svnauthz(None, None, 3, False, "accessof",
697
664
authz_url, "--path", "/jokes",
699
666
# Test --is no returns 3.
700
svntest.actions.run_and_verify_svnauthz("Anonymous access on path --is r",
701
None, None, 3, False, "accessof",
667
svntest.actions.run_and_verify_svnauthz(None, None, 3, False, "accessof",
702
668
authz_url, "--path", "/jokes",
705
671
# Anonymous access on /jokes on slapstick repo should be no
706
672
# Test --is no returns 0.
707
svntest.actions.run_and_verify_svnauthz("Anon access on path w/ repo --is no",
708
None, None, 0, False, "accessof",
673
svntest.actions.run_and_verify_svnauthz(None, None, 0, False, "accessof",
709
674
authz_url, "--path", "/jokes",
710
675
"--repository", "slapstick",
712
677
# Test --is rw returns 3.
713
svntest.actions.run_and_verify_svnauthz("Anon access on path w/ repo --is no",
714
None, None, 3, False, "accessof",
678
svntest.actions.run_and_verify_svnauthz(None, None, 3, False, "accessof",
715
679
authz_url, "--path", "/jokes",
716
680
"--repository", "slapstick",
718
682
# Test --is r returns 3.
719
svntest.actions.run_and_verify_svnauthz("Anon access on path w/ repo --is no",
720
None, None, 3, False, "accessof",
683
svntest.actions.run_and_verify_svnauthz(None, None, 3, False, "accessof",
721
684
authz_url, "--path", "/jokes",
722
685
"--repository", "slapstick",
726
689
# since it returns the h ighest level of access anywhere.
727
690
# So /bios being rw for everyone means this will be rw.
728
691
# Test --is rw returns 0.
729
svntest.actions.run_and_verify_svnauthz("User access --is rw", None, None,
692
svntest.actions.run_and_verify_svnauthz(None, None,
730
693
0, False, "accessof", authz_url,
731
694
"--username", "groucho", "--is",
733
696
# Test --is r returns 3.
734
svntest.actions.run_and_verify_svnauthz("User access --is r", None, None,
697
svntest.actions.run_and_verify_svnauthz(None, None,
735
698
3, False, "accessof", authz_url,
736
699
"--username", "groucho", "--is",
738
701
# Test --is no returns 3.
739
svntest.actions.run_and_verify_svnauthz("User access --is no", None, None,
702
svntest.actions.run_and_verify_svnauthz(None, None,
740
703
3, False, "accessof", authz_url,
741
704
"--username", "groucho", "--is",
744
707
# User groucho specified on /jokes with no repo, will not match any of the
745
708
# repo specific sections, so is r since everyone has read access.
746
709
# Test --is r returns 0.
747
svntest.actions.run_and_verify_svnauthz("User access on path --is r", None,
710
svntest.actions.run_and_verify_svnauthz(None,
748
711
None, 0, False, "accessof",
749
712
authz_url, "--path", "/jokes",
750
713
"--username", "groucho", "--is", "r")
751
714
# Test --is rw returns 3.
752
svntest.actions.run_and_verify_svnauthz("User access on path --is rw", None,
715
svntest.actions.run_and_verify_svnauthz(None,
753
716
None, 3, False, "accessof",
754
717
authz_url, "--path", "/jokes",
755
718
"--username", "groucho",
757
720
# Test --is no returns 3.
758
svntest.actions.run_and_verify_svnauthz("User access on path --is no", None,
721
svntest.actions.run_and_verify_svnauthz(None,
759
722
None, 3, False, "accessof",
760
723
authz_url, "--path", "/jokes",
761
724
"--username", "groucho",
764
727
# User groucho specified on /jokes with the repo comedy will be rw
765
728
# Test --is rw returns 0.
766
svntest.actions.run_and_verify_svnauthz("User access on path w/ repo --is rw",
767
None, None, 0, False, "accessof",
729
svntest.actions.run_and_verify_svnauthz(None, None, 0, False, "accessof",
768
730
authz_url, "--path", "/jokes",
769
731
"--username", "groucho",
770
732
"--repository", "comedy", "--is",
772
734
# Test --is r returns 3.
773
svntest.actions.run_and_verify_svnauthz("User access on path w/ repo --is r",
774
None, None, 3, False, "accessof",
735
svntest.actions.run_and_verify_svnauthz(None, None, 3, False, "accessof",
775
736
authz_url, "--path", "/jokes",
776
737
"--username", "groucho",
777
738
"--repository", "comedy", "--is",
779
740
# Test --is no returns 3.
780
svntest.actions.run_and_verify_svnauthz("User access on path w/ repo --is no",
781
None, None, 3, False, "accessof",
741
svntest.actions.run_and_verify_svnauthz(None, None, 3, False, "accessof",
782
742
authz_url, "--path", "/jokes",
783
743
"--username", "groucho",
784
744
"--repository", "comedy", "--is",
788
748
svntest.main.file_append(authz_path, "x\n")
789
749
expected_output = wc.State(wc_dir, {'A/authz' : Item(verb='Sending')})
790
750
expected_status.tweak('A/authz', wc_rev=3)
791
if svntest.actions.run_and_verify_commit(wc_dir, expected_output,
792
expected_status, None, wc_dir):
793
raise svntest.Failure
751
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
795
754
# Check that --is returns 1 when the syntax is invalid with a url.
796
755
expected_out = svntest.verify.RegexOutput(
797
756
".*Error while parsing config file:",
800
svntest.actions.run_and_verify_svnauthz("--is with invalid authz url",
801
None, expected_out, 1, False,
759
svntest.actions.run_and_verify_svnauthz(None, expected_out, 1, False,
802
760
"accessof", authz_url, "--path",
803
761
"/jokes", "--username", "groucho",
804
762
"--repository", "comedy", "--is",
848
805
expected_output = wc.State(wc_dir, {'A/authz' : Item(verb='Sending')})
849
806
expected_status.tweak('A/authz', status=' ', wc_rev=3)
850
807
svntest.main.file_append(authz_path, "groucho = r\n")
851
if svntest.actions.run_and_verify_commit(wc_dir, expected_output,
852
expected_status, None, wc_dir):
853
raise svntest.Failure
808
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
854
810
expected_data = svntest.verify.ExpectedOutput('Exit 3\n', match_all=False)
855
811
verify_logfile(logfilepath, expected_data)
857
# break the authz file with a non-existant group and check for an exit 1.
813
# break the authz file with a non-existent group and check for an exit 1.
858
814
expected_status.tweak('A/authz', status=' ', wc_rev=4)
859
815
svntest.main.file_append(authz_path, "@friends = rw\n")
860
if svntest.actions.run_and_verify_commit(wc_dir, expected_output,
861
expected_status, None, wc_dir):
862
raise svntest.Failure
816
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
863
818
expected_data = svntest.verify.ExpectedOutput('Exit 1\n', match_all=False)
864
819
verify_logfile(logfilepath, expected_data)
866
# break the authz file with a non-existant gropu and check for an exit 2.
821
# break the authz file with a non-existent gropu and check for an exit 2.
867
822
expected_output = wc.State(wc_dir, {'A/authz' : Item(verb='Deleting')})
868
823
expected_status.remove('A/authz')
869
824
svntest.main.run_svn(None, 'rm', authz_path)
870
if svntest.actions.run_and_verify_commit(wc_dir, expected_output,
871
expected_status, None, wc_dir):
872
raise svntest.Failure
825
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
873
827
expected_data = svntest.verify.ExpectedOutput('Exit 2\n', match_all=False)
874
828
verify_logfile(logfilepath, expected_data)
876
830
def svnauthz_compat_mode_file_test(sbox):
877
"test 'svnauthz-validate' compatability mode file"
831
"test 'svnauthz-validate' compatibility mode file"
880
834
# Create an authz file
883
837
svntest.main.file_write(authz_path, authz_content)
885
839
# Check a valid file.
886
svntest.actions.run_and_verify_svnauthz("svnauthz-validate on file",
840
svntest.actions.run_and_verify_svnauthz(None, None, 0, True,
890
843
# Check an invalid file.
891
844
svntest.main.file_append(authz_path, "x\n")
892
svntest.actions.run_and_verify_svnauthz("svnauthz-validate on invalid file",
845
svntest.actions.run_and_verify_svnauthz(None, None, 1, True,
896
848
# Remove the file.
897
849
os.close(authz_fd)
898
850
os.remove(authz_path)
900
# Check a non-existant file.
852
# Check a non-existent file.
901
853
svntest.actions.run_and_verify_svnauthz(
902
"svnauthz-validate on non-existant file", None, None, 2, True,
907
859
@SkipUnless(svntest.main.is_ra_type_file)
908
860
def svnauthz_compat_mode_repo_test(sbox):
909
"test 'svnauthz-validate' compatability mode url"
861
"test 'svnauthz-validate' compatibility mode url"
912
864
wc_dir = sbox.wc_dir
925
877
expected_status.add({
926
878
'A/authz' : Item(status=' ', wc_rev=2),
928
if svntest.actions.run_and_verify_commit(wc_dir, expected_output,
929
expected_status, None, wc_dir):
930
raise svntest.Failure
931
svntest.actions.run_and_verify_svnauthz("svnauthz-validate on url",
880
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
882
svntest.actions.run_and_verify_svnauthz(None, None, 0, True,
935
885
# Check an invalid url.
936
886
svntest.main.file_append(authz_path, "x\n")
937
887
expected_output = wc.State(wc_dir, {'A/authz' : Item(verb='Sending')})
938
888
expected_status.tweak('A/authz', status=' ', wc_rev=3)
939
if svntest.actions.run_and_verify_commit(wc_dir, expected_output,
940
expected_status, None, wc_dir):
941
raise svntest.Failure
942
svntest.actions.run_and_verify_svnauthz("svnauthz-validate on invalid file",
889
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
891
svntest.actions.run_and_verify_svnauthz(None, None, 1, True,
946
# Check a non-existant url.
894
# Check a non-existent url.
947
895
# Exit code really should be 2 since this is an operational error.
948
896
svntest.actions.run_and_verify_svnauthz(
949
"svnauthz-validate on non-existant file", None, None, 2, True,
950
898
repo_url + "/zilch"