from manifestacoes.db import Mongo


DATA = {
    "_id": "ObjectId('5cea8ea35c20d46c16b99634')",
    "created_at": "Sun May 26 13:03:26 +0000 2019",
    "id": 1132633340841009152,
    "id_str": "1132633340841009152",
    "text": "Insano!",
    "source": '<a href="https://mobile.twitter.com" rel="nofollow">Twitter Web App</a>',
    "truncated": False,
    "in_reply_to_status_id": None,
    "in_reply_to_status_id_str": None,
    "in_reply_to_user_id": None,
    "in_reply_to_user_id_str": None,
    "in_reply_to_screen_name": None,
    "user": {
        "id": 984937938554441731,
        "id_str": "984937938554441731",
        "name": "dr.fabriciomoraes0001@gmail.com",
        "screen_name": "DrALMEIDA0001",
        "location": "Porto Velho, Brasil",
        "url": None,
        "description": "Doutor em Física - UFC(2005). Física. Mat. Eng. da comp.  Praestoesto - Deus Vult.\nE conhecereis a verdade, e a verdade vos libertará(João 8:32). DIREITA.",
        "translator_type": "none",
        "protected": False,
        "verified": False,
        "followers_count": 2195,
        "friends_count": 5003,
        "listed_count": 2,
        "favourites_count": 19,
        "statuses_count": 35043,
        "created_at": "Fri Apr 13 23:34:38 +0000 2018",
        "utc_offset": None,
        "time_zone": None,
        "geo_enabled": False,
        "lang": None,
        "contributors_enabled": False,
        "is_translator": False,
        "profile_background_color": "F5F8FA",
        "profile_background_image_url": "",
        "profile_background_image_url_https": "",
        "profile_background_tile": False,
        "profile_link_color": "1DA1F2",
        "profile_sidebar_border_color": "C0DEED",
        "profile_sidebar_fill_color": "DDEEF6",
        "profile_text_color": "333333",
        "profile_use_background_image": True,
        "profile_image_url": "http://pbs.twimg.com/profile_images/1127718821815570432/pXX4jYfp_normal.jpg",
        "profile_image_url_https": "https://pbs.twimg.com/profile_images/1127718821815570432/pXX4jYfp_normal.jpg",
        "profile_banner_url": "https://pbs.twimg.com/profile_banners/984937938554441731/1523750013",
        "default_profile": True,
        "default_profile_image": False,
        "following": None,
        "follow_request_sent": None,
        "notifications": None,
    },
    "geo": None,
    "coordinates": None,
    "place": None,
    "contributors": None,
    "quoted_status_id": 1132611425229258753,
    "quoted_status_id_str": "1132611425229258753",
    "quoted_status": {
        "created_at": "Sun May 26 11:36:21 +0000 2019",
        "id": 1132611425229258753,
        "id_str": "1132611425229258753",
        "text": "A esquerda sobe uma TAG contra as manifestações e pra variar tem CU no meio.\n\nNão é possível, tudo pra eles te CU… https://t.co/dWo62pMco0",
        "source": '<a href="http://twitter.com/download/android" rel="nofollow">Twitter for Android</a>',
        "truncated": True,
        "in_reply_to_status_id": None,
        "in_reply_to_status_id_str": None,
        "in_reply_to_user_id": None,
        "in_reply_to_user_id_str": None,
        "in_reply_to_screen_name": None,
        "user": {
            "id": 635764127,
            "id_str": "635764127",
            "name": "Carlos Cezar",
            "screen_name": "carloscezarcjr",
            "location": "Brasil",
            "url": None,
            "description": "Brasileiro com orgulho!\nAnti comunismo, política, de direita.\nMúsica, cinema, futebol, viagem! Não esquece de acionar o 🔔",
            "translator_type": "none",
            "protected": False,
            "verified": False,
            "followers_count": 13125,
            "friends_count": 12815,
            "listed_count": 8,
            "favourites_count": 44227,
            "statuses_count": 14535,
            "created_at": "Sun Jul 15 00:19:55 +0000 2012",
            "utc_offset": None,
            "time_zone": None,
            "geo_enabled": False,
            "lang": None,
            "contributors_enabled": False,
            "is_translator": False,
            "profile_background_color": "000000",
            "profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png",
            "profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png",
            "profile_background_tile": False,
            "profile_link_color": "000000",
            "profile_sidebar_border_color": "000000",
            "profile_sidebar_fill_color": "000000",
            "profile_text_color": "000000",
            "profile_use_background_image": False,
            "profile_image_url": "http://pbs.twimg.com/profile_images/1104726513272918018/hplkVA1w_normal.jpg",
            "profile_image_url_https": "https://pbs.twimg.com/profile_images/1104726513272918018/hplkVA1w_normal.jpg",
            "profile_banner_url": "https://pbs.twimg.com/profile_banners/635764127/1550407548",
            "default_profile": False,
            "default_profile_image": False,
            "following": None,
            "follow_request_sent": None,
            "notifications": None,
        },
        "geo": None,
        "coordinates": None,
        "place": None,
        "contributors": None,
        "is_quote_status": False,
        "extended_tweet": {
            "full_text": "A esquerda sobe uma TAG contra as manifestações e pra variar tem CU no meio.\n\nNão é possível, tudo pra eles te CU 🤦\u200d♂️\n\nPensam pelo CU, agem pelo CU, se inspiram pelo CU, se espelham pelo CU, vivem pelo CU.\n\nMas podem ter certeza: vão tomar no CU.\n\n#BrasilNasRuas",
            "display_text_range": [0, 263],
            "entities": {
                "hashtags": [{"text": "BrasilNasRuas", "indices": [249, 263]}],
                "urls": [],
                "user_mentions": [],
                "symbols": [],
            },
        },
        "quote_count": 14,
        "reply_count": 55,
        "retweet_count": 120,
        "favorite_count": 406,
        "entities": {
            "hashtags": [],
            "urls": [
                {
                    "url": "https://t.co/dWo62pMco0",
                    "expanded_url": "https://twitter.com/i/web/status/1132611425229258753",
                    "display_url": "twitter.com/i/web/status/1…",
                    "indices": [115, 138],
                }
            ],
            "user_mentions": [],
            "symbols": [],
        },
        "favorited": False,
        "retweeted": False,
        "filter_level": "low",
        "lang": "pt",
    },
    "quoted_status_permalink": {
        "url": "https://t.co/rXNtDeMDHF",
        "expanded": "https://twitter.com/carloscezarcjr/status/1132611425229258753",
        "display": "twitter.com/carloscezarcjr…",
    },
    "is_quote_status": True,
    "quote_count": 0,
    "reply_count": 0,
    "retweet_count": 0,
    "favorite_count": 0,
    "entities": {"hashtags": [], "urls": [], "user_mentions": [], "symbols": []},
    "favorited": False,
    "retweeted": False,
    "filter_level": "low",
    "lang": "es",
    "timestamp_ms": "1558875806423",
}


EXPECTED = {
    "created_at": "Sun May 26 13:03:26 +0000 2019",
    "id_str": "1132633340841009152",
    "text": "Insano!",
    "source": '<a href="https://mobile.twitter.com" rel="nofollow">Twitter Web App</a>',
    "in_reply_to_status_id_str": None,
    "in_reply_to_user_id_str": None,
    "in_reply_to_screen_name": None,
    "user_id_str": "984937938554441731",
    "user_name": "dr.fabriciomoraes0001@gmail.com",
    "user_screen_name": "DrALMEIDA0001",
    "user_location": "Porto Velho, Brasil",
    "user_description": "Doutor em Física - UFC(2005). Física. Mat. Eng. da comp.  Praestoesto - Deus Vult.\nE conhecereis a verdade, e a verdade vos libertará(João 8:32). DIREITA.",
    "user_verified": False,
    "user_followers_count": 2195,
    "user_friends_count": 5003,
    "user_listed_count": 2,
    "user_statuses_count": 35043,
    "user_created_at": "Fri Apr 13 23:34:38 +0000 2018",
    "user_default_profile": True,
    "user_default_profile_image": False,
    "quoted_status_id_str": "1132611425229258753",
    "quoted_status_created_at": "Sun May 26 11:36:21 +0000 2019",
    "quoted_status_id_str": "1132611425229258753",
    "quoted_status_user_id_str": "635764127",
    "quoted_status_user_screen_name": "carloscezarcjr",
    "quote_count": 0,
    "reply_count": 0,
    "retweet_count": 0,
    "favorite_count": 0,
    "lang": "es",
}


def test_serialize():
    assert Mongo.serialize(DATA) == EXPECTED
