Ejemplo n.º 1
0
    def test_returns_something_in_production_json(self):
        """
        Since we know that test_given_list_returns_only_videos works, then
        we only need to check that we return something for the actual contents.json
        to make sure we're reading the right attributes.
        """
        data = retrieve_kalite_data()

        assert _get_video_ids(data)
Ejemplo n.º 2
0
    def test_given_list_returns_only_videos(self, contents):
        contents = [{
            "kind": kind,
            "id": content_id
        } for content_id, kind in contents]
        video_count = len(
            [node for node in contents if node.get("kind") == "Video"])

        assert len(_get_video_ids(contents)) == video_count
    def test_returns_something_in_production_json(self):
        """
        Since we know that test_given_list_returns_only_videos works, then
        we only need to check that we return something for the actual contents.json
        to make sure we're reading the right attributes.
        """
        data = retrieve_kalite_data()

        assert _get_video_ids(data)
Ejemplo n.º 4
0
def _get_all_video_ids():
    """
    Test utility function so we only need to generate the list of video
    ids once, and then assign that to an instance variable. We
    wrap it as a function instead of assigning the value of
    retrieve_kalite_content_data directly so we can use the
    cassette system to cache the results, avoiding an expensive
    http request.

    """
    content_data = retrieve_kalite_data()

    ids = _get_video_ids(content_data)

    # return a tuple, to make sure it gets never modified.
    ids_tuple = tuple(ids)

    # just take the first 10 ids -- don't run too many
    return ids_tuple[:10]
def _get_all_video_ids():
    """
    Test utility function so we only need to generate the list of video
    ids once, and then assign that to an instance variable. We
    wrap it as a function instead of assigning the value of
    retrieve_kalite_content_data directly so we can use the
    cassette system to cache the results, avoiding an expensive
    http request.

    """
    content_data = retrieve_kalite_data()

    ids = _get_video_ids(content_data)

    # return a tuple, to make sure it gets never modified.
    ids_tuple = tuple(ids)

    # just take the first 10 ids -- don't run too many
    return ids_tuple[:10]
    def test_given_list_returns_only_videos(self, contents):
        contents = [{"kind": kind, "id": content_id} for content_id, kind in contents]
        video_count = len([node for node in contents if node.get("kind") == "Video"])

        assert len(_get_video_ids(contents)) == video_count
    def test_given_list_returns_only_videos(self, contents):
        content = {id: {"kind": kind} for id, kind in contents}
        video_count = len([id for id in content if content[id]["kind"] == "Video"])

        assert len(_get_video_ids(content)) == video_count