Exemplo n.º 1
0
    def test_authorize_url(self):
        url = authorize_url()
        assert_regex_matches(self, url, 'response_type=code')
        assert_regex_matches(self, url, 'scope=openid')
        assert_regex_matches(self, url, 'client_id=%s' % (client_id))
        assert_regex_matches(self, url, 'https://www.sandbox.paypal.com')

        self.assertEqual(endpoint(), 'https://api.sandbox.paypal.com')
  def test_authorize_url(self):
    url = authorize_url()
    assert_regex_matches(self, url, 'response_type=code')
    assert_regex_matches(self, url, 'scope=openid')
    assert_regex_matches(self, url, 'client_id=%s'%(client_id))
    assert_regex_matches(self, url, 'https://www.sandbox.paypal.com')

    self.assertEqual(endpoint(), 'https://api.sandbox.paypal.com')
  def test_live_mode_url(self):
    try:
      paypal.configure( mode='live',  client_id=client_id, client_secret=client_secret )
      url = authorize_url()
      assert_regex_matches(self, url, 'response_type=code')
      assert_regex_matches(self, url, 'scope=openid')
      assert_regex_matches(self, url, 'client_id=%s'%(client_id))
      assert_regex_matches(self, url, 'https://www.paypal.com')

      self.assertEqual(endpoint(), 'https://api.paypal.com')
    finally:
      paypal.configure( mode='sandbox', client_id=client_id, client_secret=client_secret )
Exemplo n.º 4
0
    def test_authorize_url_with_api(self):
        custom_api = Api(mode="sandbox",
                         client_id='custom_client_id',
                         client_secret='custom_client_secret',
                         openid_endpoint='https://def.abc',
                         openid_redirect_uri='http://abc.def/')
        url = authorize_url(api=custom_api)
        assert_regex_matches(self, url, 'response_type=code')
        assert_regex_matches(self, url, 'scope=openid')
        assert_regex_matches(self, url, 'client_id=custom_client_id')
        assert_regex_matches(self, url, 'redirect_uri=http%3A%2F%2Fabc.def%2F')

        self.assertEqual(endpoint(custom_api), 'https://def.abc')
Exemplo n.º 5
0
    def test_live_mode_url(self):
        try:
            paypal.configure(
                mode='live', client_id=client_id, client_secret=client_secret)
            url = authorize_url()
            assert_regex_matches(self, url, 'response_type=code')
            assert_regex_matches(self, url, 'scope=openid')
            assert_regex_matches(self, url, 'client_id=%s' % (client_id))
            assert_regex_matches(self, url, 'https://www.paypal.com')

            self.assertEqual(endpoint(), 'https://api.paypal.com')
        finally:
            paypal.configure(
                mode='sandbox', client_id=client_id, client_secret=client_secret)
 def test_authorize_url_options(self):
   url = authorize_url({ 'scope': 'openid profile' })
   assert_regex_matches(self, url, 'scope=openid\+profile')
Exemplo n.º 7
0
 def test_authorize_url_options(self):
     url = authorize_url({'scope': 'openid profile'})
     assert_regex_matches(self, url, 'scope=openid\+profile')
 def test_authorize_url(self):
     url = authorize_url()
     assert_regex_matches(self, url, 'response_type=code')
     assert_regex_matches(self, url, 'scope=openid')
     assert_regex_matches(self, url, 'client_id=%s' % (client_id))
 def test_authorize_url(self):
   url = authorize_url()
   assert_regex_matches(self, url, 'response_type=code')
   assert_regex_matches(self, url, 'scope=openid')
   assert_regex_matches(self, url, 'client_id=%s'%(client_id))