(t *testing.T)
| 844 | } |
| 845 | |
| 846 | func Test_transformSecurityAndAnalysisOpts(t *testing.T) { |
| 847 | tests := []struct { |
| 848 | name string |
| 849 | opts EditOptions |
| 850 | want *SecurityAndAnalysisInput |
| 851 | }{ |
| 852 | { |
| 853 | name: "Enable all security and analysis settings", |
| 854 | opts: EditOptions{ |
| 855 | Edits: EditRepositoryInput{ |
| 856 | enableAdvancedSecurity: bp(true), |
| 857 | enableSecretScanning: bp(true), |
| 858 | enableSecretScanningPushProtection: bp(true), |
| 859 | }, |
| 860 | }, |
| 861 | want: &SecurityAndAnalysisInput{ |
| 862 | EnableAdvancedSecurity: &SecurityAndAnalysisStatus{ |
| 863 | Status: sp("enabled"), |
| 864 | }, |
| 865 | EnableSecretScanning: &SecurityAndAnalysisStatus{ |
| 866 | Status: sp("enabled"), |
| 867 | }, |
| 868 | EnableSecretScanningPushProtection: &SecurityAndAnalysisStatus{ |
| 869 | Status: sp("enabled"), |
| 870 | }, |
| 871 | }, |
| 872 | }, |
| 873 | { |
| 874 | name: "Disable all security and analysis settings", |
| 875 | opts: EditOptions{ |
| 876 | Edits: EditRepositoryInput{ |
| 877 | enableAdvancedSecurity: bp(false), |
| 878 | enableSecretScanning: bp(false), |
| 879 | enableSecretScanningPushProtection: bp(false), |
| 880 | }, |
| 881 | }, |
| 882 | want: &SecurityAndAnalysisInput{ |
| 883 | EnableAdvancedSecurity: &SecurityAndAnalysisStatus{ |
| 884 | Status: sp("disabled"), |
| 885 | }, |
| 886 | EnableSecretScanning: &SecurityAndAnalysisStatus{ |
| 887 | Status: sp("disabled"), |
| 888 | }, |
| 889 | EnableSecretScanningPushProtection: &SecurityAndAnalysisStatus{ |
| 890 | Status: sp("disabled"), |
| 891 | }, |
| 892 | }, |
| 893 | }, |
| 894 | { |
| 895 | name: "Enable only advanced security", |
| 896 | opts: EditOptions{ |
| 897 | Edits: EditRepositoryInput{ |
| 898 | enableAdvancedSecurity: bp(true), |
| 899 | }, |
| 900 | }, |
| 901 | want: &SecurityAndAnalysisInput{ |
| 902 | EnableAdvancedSecurity: &SecurityAndAnalysisStatus{ |
| 903 | Status: sp("enabled"), |
nothing calls this directly
no test coverage detected