| 1 | from .conftest import get_client, verify_request_count |
| 2 | |
| 3 | from auth0.management import ( |
| 4 | BrandingThemeBorders, |
| 5 | BrandingThemeColors, |
| 6 | BrandingThemeFontBodyText, |
| 7 | BrandingThemeFontButtonsText, |
| 8 | BrandingThemeFontInputLabels, |
| 9 | BrandingThemeFontLinks, |
| 10 | BrandingThemeFonts, |
| 11 | BrandingThemeFontSubtitle, |
| 12 | BrandingThemeFontTitle, |
| 13 | BrandingThemePageBackground, |
| 14 | BrandingThemeWidget, |
| 15 | ) |
| 16 | |
| 17 | |
| 18 | def test_branding_themes_create() -> None: |
| 19 | """Test create endpoint with WireMock""" |
| 20 | test_id = "branding.themes.create.0" |
| 21 | client = get_client(test_id) |
| 22 | client.branding.themes.create( |
| 23 | borders=BrandingThemeBorders( |
| 24 | button_border_radius=1.1, |
| 25 | button_border_weight=1.1, |
| 26 | buttons_style="pill", |
| 27 | input_border_radius=1.1, |
| 28 | input_border_weight=1.1, |
| 29 | inputs_style="pill", |
| 30 | show_widget_shadow=True, |
| 31 | widget_border_weight=1.1, |
| 32 | widget_corner_radius=1.1, |
| 33 | ), |
| 34 | colors=BrandingThemeColors( |
| 35 | body_text="body_text", |
| 36 | error="error", |
| 37 | header="header", |
| 38 | icons="icons", |
| 39 | input_background="input_background", |
| 40 | input_border="input_border", |
| 41 | input_filled_text="input_filled_text", |
| 42 | input_labels_placeholders="input_labels_placeholders", |
| 43 | links_focused_components="links_focused_components", |
| 44 | primary_button="primary_button", |
| 45 | primary_button_label="primary_button_label", |
| 46 | secondary_button_border="secondary_button_border", |
| 47 | secondary_button_label="secondary_button_label", |
| 48 | success="success", |
| 49 | widget_background="widget_background", |
| 50 | widget_border="widget_border", |
| 51 | ), |
| 52 | fonts=BrandingThemeFonts( |
| 53 | body_text=BrandingThemeFontBodyText( |
| 54 | bold=True, |
| 55 | size=1.1, |
| 56 | ), |
| 57 | buttons_text=BrandingThemeFontButtonsText( |
| 58 | bold=True, |
| 59 | size=1.1, |
| 60 | ), |
| 61 | font_url="font_url", |
| 62 | input_labels=BrandingThemeFontInputLabels( |
| 63 | bold=True, |
| 64 | size=1.1, |
| 65 | ), |
| 66 | links=BrandingThemeFontLinks( |
| 67 | bold=True, |
| 68 | size=1.1, |
| 69 | ), |
| 70 | links_style="normal", |
| 71 | reference_text_size=1.1, |
| 72 | subtitle=BrandingThemeFontSubtitle( |
| 73 | bold=True, |
| 74 | size=1.1, |
| 75 | ), |
| 76 | title=BrandingThemeFontTitle( |
| 77 | bold=True, |
| 78 | size=1.1, |
| 79 | ), |
| 80 | ), |
| 81 | page_background=BrandingThemePageBackground( |
| 82 | background_color="background_color", |
| 83 | background_image_url="background_image_url", |
| 84 | page_layout="center", |
| 85 | ), |
| 86 | widget=BrandingThemeWidget( |
| 87 | header_text_alignment="center", |
| 88 | logo_height=1.1, |
| 89 | logo_position="center", |
| 90 | logo_url="logo_url", |
| 91 | social_buttons_layout="bottom", |
| 92 | ), |
| 93 | ) |
| 94 | verify_request_count(test_id, "POST", "/branding/themes", None, 1) |
| 95 | |
| 96 | |
| 97 | def test_branding_themes_get_default() -> None: |
| 98 | """Test getDefault endpoint with WireMock""" |
| 99 | test_id = "branding.themes.get_default.0" |
| 100 | client = get_client(test_id) |
| 101 | client.branding.themes.get_default() |
| 102 | verify_request_count(test_id, "GET", "/branding/themes/default", None, 1) |
| 103 | |
| 104 | |
| 105 | def test_branding_themes_get() -> None: |
| 106 | """Test get endpoint with WireMock""" |
| 107 | test_id = "branding.themes.get.0" |
| 108 | client = get_client(test_id) |
| 109 | client.branding.themes.get( |
| 110 | theme_id="themeId", |
| 111 | ) |
| 112 | verify_request_count(test_id, "GET", "/branding/themes/themeId", None, 1) |
| 113 | |
| 114 | |
| 115 | def test_branding_themes_delete() -> None: |
| 116 | """Test delete endpoint with WireMock""" |
| 117 | test_id = "branding.themes.delete.0" |
| 118 | client = get_client(test_id) |
| 119 | client.branding.themes.delete( |
| 120 | theme_id="themeId", |
| 121 | ) |
| 122 | verify_request_count(test_id, "DELETE", "/branding/themes/themeId", None, 1) |
| 123 | |
| 124 | |
| 125 | def test_branding_themes_update() -> None: |
| 126 | """Test update endpoint with WireMock""" |
| 127 | test_id = "branding.themes.update.0" |
| 128 | client = get_client(test_id) |
| 129 | client.branding.themes.update( |
| 130 | theme_id="themeId", |
| 131 | borders=BrandingThemeBorders( |
| 132 | button_border_radius=1.1, |
| 133 | button_border_weight=1.1, |
| 134 | buttons_style="pill", |
| 135 | input_border_radius=1.1, |
| 136 | input_border_weight=1.1, |
| 137 | inputs_style="pill", |
| 138 | show_widget_shadow=True, |
| 139 | widget_border_weight=1.1, |
| 140 | widget_corner_radius=1.1, |
| 141 | ), |
| 142 | colors=BrandingThemeColors( |
| 143 | body_text="body_text", |
| 144 | error="error", |
| 145 | header="header", |
| 146 | icons="icons", |
| 147 | input_background="input_background", |
| 148 | input_border="input_border", |
| 149 | input_filled_text="input_filled_text", |
| 150 | input_labels_placeholders="input_labels_placeholders", |
| 151 | links_focused_components="links_focused_components", |
| 152 | primary_button="primary_button", |
| 153 | primary_button_label="primary_button_label", |
| 154 | secondary_button_border="secondary_button_border", |
| 155 | secondary_button_label="secondary_button_label", |
| 156 | success="success", |
| 157 | widget_background="widget_background", |
| 158 | widget_border="widget_border", |
| 159 | ), |
| 160 | fonts=BrandingThemeFonts( |
| 161 | body_text=BrandingThemeFontBodyText( |
| 162 | bold=True, |
| 163 | size=1.1, |
| 164 | ), |
| 165 | buttons_text=BrandingThemeFontButtonsText( |
| 166 | bold=True, |
| 167 | size=1.1, |
| 168 | ), |
| 169 | font_url="font_url", |
| 170 | input_labels=BrandingThemeFontInputLabels( |
| 171 | bold=True, |
| 172 | size=1.1, |
| 173 | ), |
| 174 | links=BrandingThemeFontLinks( |
| 175 | bold=True, |
| 176 | size=1.1, |
| 177 | ), |
| 178 | links_style="normal", |
| 179 | reference_text_size=1.1, |
| 180 | subtitle=BrandingThemeFontSubtitle( |
| 181 | bold=True, |
| 182 | size=1.1, |
| 183 | ), |
| 184 | title=BrandingThemeFontTitle( |
| 185 | bold=True, |
| 186 | size=1.1, |
| 187 | ), |
| 188 | ), |
| 189 | page_background=BrandingThemePageBackground( |
| 190 | background_color="background_color", |
| 191 | background_image_url="background_image_url", |
| 192 | page_layout="center", |
| 193 | ), |
| 194 | widget=BrandingThemeWidget( |
| 195 | header_text_alignment="center", |
| 196 | logo_height=1.1, |
| 197 | logo_position="center", |
| 198 | logo_url="logo_url", |
| 199 | social_buttons_layout="bottom", |
| 200 | ), |
| 201 | ) |
| 202 | verify_request_count(test_id, "PATCH", "/branding/themes/themeId", None, 1) |