Exemplo n.º 1
0
    def test_dashboards_without_filtersets__200(self, dashboard_id: int,
                                                client: FlaskClient[Any]):
        # arrange
        login(client, "admin")

        # act
        response = call_get_filter_sets(client, dashboard_id)

        # assert
        assert response.status_code == 200
        assert response.is_json and response.json["count"] == 0
Exemplo n.º 2
0
    def test_with_dashboard_not_exists__404(
        self,
        not_exists_dashboard_id: int,
        client: FlaskClient[Any],
    ):
        # arrange
        login(client, "admin")

        # act
        response = call_get_filter_sets(client, not_exists_dashboard_id)

        # assert
        assert response.status_code == 404
Exemplo n.º 3
0
    def test_when_caller_filterset_owner__200(
        self,
        dashboard_id: int,
        filtersets: Dict[str, List[FilterSet]],
        client: FlaskClient[Any],
    ):
        # arrange
        login(client, FILTER_SET_OWNER_USERNAME)
        expected_ids = collect_all_ids(filtersets[FILTER_SET_OWNER_USERNAME])

        # act
        response = call_get_filter_sets(client, dashboard_id)

        # assert
        assert response.status_code == 200
        assert response.is_json and set(response.json["ids"]) == expected_ids
Exemplo n.º 4
0
    def test_when_caller_admin__200(
        self,
        dashboard_id: int,
        filtersets: Dict[str, List[FilterSet]],
        client: FlaskClient[Any],
    ):
        # arrange
        login(client, "admin")
        expected_ids: Set[int] = collect_all_ids(filtersets)

        # act
        response = call_get_filter_sets(client, dashboard_id)

        # assert
        assert response.status_code == 200
        assert response.is_json and set(response.json["ids"]) == expected_ids
Exemplo n.º 5
0
    def test_when_caller_regular_user__200(
        self,
        dashboard_id: int,
        filtersets: Dict[str, List[int]],
        client: FlaskClient[Any],
    ):
        # arrange
        login(client, REGULAR_USER)
        expected_ids: Set[int] = set()

        # act
        response = call_get_filter_sets(client, dashboard_id)

        # assert
        assert response.status_code == 200
        assert response.is_json and set(response.json["ids"]) == expected_ids