Example #1
0
  def test_profile_new_user(self):
    self.assertIsNone(Instagram.get_by_id('snarfed'))

    self.expect_requests_get('https://snarfed.org/', '')
    self.mox.ReplayAll()

    resp = self.get_response('profile?token=towkin', data=HTML_PROFILE_COMPLETE)

    self.assertEqual(200, resp.status_code)
    self.assertEqual(self.source.key.urlsafe().decode(), resp.json)

    ig = Instagram.get_by_id('snarfed')
    self.assertEqual('Ryan B', ig.name)
    self.assertEqual('https://scontent-sjc2-1.cdninstagram.com/hphotos-xfa1/t51.2885-19/11373714_959073410822287_2004790583_a.jpg', ig.picture)
    self.assertEqual('https://www.instagram.com/snarfed/', ig.silo_url())
    self.assertEqual(['https://snarfed.org/'], ig.domain_urls)
    self.assertEqual(['snarfed.org'], ig.domains)
Example #2
0
    def test_profile_new_user(self):
        self.assertIsNone(Instagram.get_by_id('snarfed'))

        self.expect_webmention_discovery()
        self.mox.ReplayAll()

        resp = app.application.get_response(
            '/instagram/browser/profile?token=towkin',
            method='POST',
            text=HTML_PROFILE_COMPLETE)

        self.assertEqual(200, resp.status_int)
        self.assertEqual([HTML_PHOTO_ACTIVITY, HTML_VIDEO_ACTIVITY], resp.json)

        ig = Instagram.get_by_id('snarfed')
        self.assertEqual('Ryan B', ig.name)
        self.assertEqual(
            'https://scontent-sjc2-1.cdninstagram.com/hphotos-xfa1/t51.2885-19/11373714_959073410822287_2004790583_a.jpg',
            ig.picture)
        self.assertEqual('https://www.instagram.com/snarfed/', ig.url)
        self.assertEqual(['https://snarfed.org/'], ig.domain_urls)
        self.assertEqual(['snarfed.org'], ig.domains)