예제 #1
0
 def test_fetches_remote_profile_if_not_found(self, mock_retrieve):
     mock_retrieve.return_value = entities.ProfileFactory(
         name="foobar",
         raw_content="barfoo",
         public_key="xyz",
         id="https:/example.com/foo/bar",
     )
     sender_profile = get_sender_profile("https:/example.com/foo/bar")
     assert isinstance(sender_profile, Profile)
     assert sender_profile.name == "foobar"
     assert sender_profile.visibility == Visibility.PUBLIC
     assert sender_profile.rsa_public_key == "xyz"
     assert not sender_profile.rsa_private_key
예제 #2
0
 def test_fetches_remote_profile_if_not_found(self, mock_retrieve):
     mock_retrieve.return_value = entities.ProfileFactory(
         name="foobar", raw_content="barfoo", public_key="xyz",
         handle="*****@*****.**", guid="123456"
     )
     sender_profile = get_sender_profile("*****@*****.**")
     assert isinstance(sender_profile, Profile)
     assert sender_profile.name == "foobar"
     assert sender_profile.guid == "123456"
     assert sender_profile.handle == "*****@*****.**"
     assert sender_profile.visibility == Visibility.LIMITED
     assert sender_profile.rsa_public_key == "xyz"
     assert not sender_profile.rsa_private_key
예제 #3
0
 def test_cleans_text_fields_in_profile(self, mock_retrieve):
     mock_retrieve.return_value = entities.ProfileFactory(
         name="<script>alert('yup');</script>",
         raw_content="<script>alert('yup');</script>",
         public_key="<script>alert('yup');</script>",
         id="https:/example.com/foo/bar",
         image_urls={
             "small": "<script>alert('yup');</script>",
             "medium": "<script>alert('yup');</script>",
             "large": "<script>alert('yup');</script>",
         },
         location="<script>alert('yup');</script>",
     )
     sender_profile = get_sender_profile("https:/example.com/foo/bar")
     assert isinstance(sender_profile, Profile)
     assert sender_profile.name == "alert('yup');"
     assert sender_profile.rsa_public_key == "alert('yup');"
     assert sender_profile.image_url_small == "alert('yup');"
     assert sender_profile.image_url_medium == "alert('yup');"
     assert sender_profile.image_url_large == "alert('yup');"
     assert sender_profile.location == "alert('yup');"