Ejemplo n.º 1
0
    def testBuildRequest(self):
        url = "https://*****:*****@maven.example.com/path/to/my/repo"
        req = util.buildRequest(url)
        self.assertTrue(req.get_header('Authorization').startswith('Basic '))

        req = util.buildRequest(url, data={'a': 'b'})
        self.assertTrue(req.get_header('Authorization').startswith('Basic '))
        self.assertEqual('application/json', req.get_header('Content-type'))
        self.assertEqual('{"a": "b"}', req.get_data())

        req = util.buildRequest(url, data={'a': 'b'}, contentType='application/x-www-form-urlencoded')
        self.assertEqual('application/x-www-form-urlencoded', req.get_header('Content-type'))
        self.assertEqual('a=b', req.get_data())
Ejemplo n.º 2
0
    def testBuildRequest(self):
        url = "https://*****:*****@maven.example.com/path/to/my/repo"
        req = util.buildRequest(url)
        self.assertTrue(req.get_header('Authorization').startswith('Basic '))

        req = util.buildRequest(url, data={'a': 'b'})
        self.assertTrue(req.get_header('Authorization').startswith('Basic '))
        self.assertEqual('application/json', req.get_header('Content-type'))
        self.assertEqual('{"a": "b"}', req.get_data())

        req = util.buildRequest(url, data={'a': 'b'}, contentType='application/x-www-form-urlencoded')
        self.assertEqual('application/x-www-form-urlencoded', req.get_header('Content-type'))
        self.assertEqual('a=b', req.get_data())
Ejemplo n.º 3
0
 def test_buildRequest(self):
     url = "https://*****:*****@maven.example.com/path/to/my/repo"
     req = util.buildRequest(url)
     self.assertTrue(req.get_header('Authorization').startswith('Basic '))