예제 #1
0
def test_delete_theme(api_client: TestClient, api_routes: AppRoutes,
                      default_theme, new_theme, token):
    for theme in [default_theme, new_theme]:
        response = api_client.delete(api_routes.themes_id(theme.get("id")),
                                     headers=token)

        assert response.status_code == 200
예제 #2
0
def test_update_theme(api_client: TestClient, api_routes: AppRoutes, token,
                      new_theme):
    theme_colors = {
        "primary": "#E12345",
        "accent": "#012345",
        "secondary": "#973542",
        "success": "#5AB1BB",
        "info": "#4990BA",
        "warning": "#FF4081",
        "error": "#EF4432",
    }

    new_theme["colors"] = theme_colors
    new_theme["name"] = "New Theme Name"
    response = api_client.put(api_routes.themes_id(new_theme.get("id")),
                              json=new_theme,
                              headers=token)
    assert response.status_code == 200
    response = api_client.get(api_routes.themes_id(new_theme.get("id")))
    assert json.loads(response.content) == new_theme
예제 #3
0
def test_create_theme(api_client: TestClient, api_routes: AppRoutes, new_theme,
                      token):

    response = api_client.post(api_routes.themes_create,
                               json=new_theme,
                               headers=token)
    assert response.status_code == 201

    response = api_client.get(api_routes.themes_id(new_theme.get("id")),
                              headers=token)
    assert response.status_code == 200
    assert json.loads(response.content) == new_theme
예제 #4
0
def test_read_theme(api_client: TestClient, api_routes: AppRoutes,
                    default_theme, new_theme):
    for theme in [default_theme, new_theme]:
        response = api_client.get(api_routes.themes_id(theme.get("id")))
        assert response.status_code == 200
        assert json.loads(response.content) == theme
예제 #5
0
def test_default_theme(api_client: TestClient, api_routes: AppRoutes,
                       default_theme):
    response = api_client.get(api_routes.themes_id(1))
    assert response.status_code == 200
    assert json.loads(response.content) == default_theme