|
63 | 63 | "share"
|
64 | 64 | ],
|
65 | 65 | "globals": ["global0"],
|
66 |
| - "instance_name": "GANDOLPH" |
| 66 | + "instance_name": "GANDOLPH", |
| 67 | + "permissions": { |
| 68 | + "method": "none" |
| 69 | + } |
67 | 70 | }
|
68 | 71 | },
|
69 | 72 | "shares": {
|
|
122 | 125 | "valid users": "sambauser",
|
123 | 126 | "guest ok": "no",
|
124 | 127 | "force user": "root"
|
| 128 | + }, |
| 129 | + "permissions": { |
| 130 | + "method": "none" |
125 | 131 | }
|
126 | 132 | }
|
127 | 133 | },
|
@@ -714,3 +720,43 @@ def test_instance_config_equality(json_a, json_b, iname, expect_equal):
|
714 | 720 | assert instance_a == instance_b
|
715 | 721 | else:
|
716 | 722 | assert instance_a != instance_b
|
| 723 | + |
| 724 | + |
| 725 | +def test_permissions_config_default(): |
| 726 | + c1 = sambacc.config.GlobalConfig(io.StringIO(config1)) |
| 727 | + ic = c1.get("foobar") |
| 728 | + for share in ic.shares(): |
| 729 | + assert share.permissions_config().method == "none" |
| 730 | + |
| 731 | + |
| 732 | +def test_permissions_config_instance(): |
| 733 | + c2 = sambacc.config.GlobalConfig(io.StringIO(config2)) |
| 734 | + ic = c2.get("foobar") |
| 735 | + # TODO: improve test to ensure this isn't getting the default. it does |
| 736 | + # work as designed based on coverage, but we shouldn't rely on that |
| 737 | + for share in ic.shares(): |
| 738 | + assert share.permissions_config().method == "none" |
| 739 | + |
| 740 | + |
| 741 | +def test_permissions_config_share(): |
| 742 | + c3 = sambacc.config.GlobalConfig(io.StringIO(config3)) |
| 743 | + ic = c3.get("foobar") |
| 744 | + # TODO: improve test to ensure this isn't getting the default. it does |
| 745 | + # work as designed based on coverage, but we shouldn't rely on that |
| 746 | + for share in ic.shares(): |
| 747 | + assert share.permissions_config().method == "none" |
| 748 | + |
| 749 | + |
| 750 | +def test_permissions_config_options(): |
| 751 | + pc = sambacc.config.PermissionsConfig( |
| 752 | + { |
| 753 | + "method": "initialize-share-perms", |
| 754 | + "status_xattr": "user.fake-stuff", |
| 755 | + "mode": "0777", |
| 756 | + "friendship": "always", |
| 757 | + } |
| 758 | + ) |
| 759 | + opts = pc.options |
| 760 | + assert len(opts) == 2 |
| 761 | + assert "mode" in opts |
| 762 | + assert "friendship" in opts |
0 commit comments