def test_get_project(self): """ Test that a project can be fetched """ reference = Gerrit(url=self.URL) reference.call = self.call reference.get_project(self.PROJECT) self.call.assert_called_with(r_endpoint='/a/projects/{}/'.format( self.PROJECT), )
def test_get_project(self, mock_get_netrc_auth): mock_get_netrc_auth.return_value = ('user', 'password') req = mock.Mock() req.status_code = 200 req.content = ')]}\'{}'.encode('utf-8') call = mock.Mock() call.return_value = req reference = Gerrit(url='http://domain.com') reference.call = call project = reference.get_project('gerritproject') call.assert_called_with(r_endpoint='/a/projects/gerritproject/', )
def test_create_project(self): """ Test that a project can be created """ self.req.status_code = 201 reference = Gerrit(url=self.URL) reference.call = self.call with mock.patch.object(Project, 'get_project'): reference.create_project(self.PROJECT) self.call.assert_called_with( request='put', r_endpoint='/a/projects/{}'.format(self.PROJECT), r_payload={}, )
def test_get_project(self, mock_get_netrc_auth): mock_get_netrc_auth.return_value = ('user', 'password') req = mock.Mock() req.status_code = 200 req.content = ')]}\'{}'.encode('utf-8') call = mock.Mock() call.return_value = req reference = Gerrit(url='http://domain.com') reference.call = call project = reference.get_project('gerritproject') call.assert_called_with( r_endpoint='/a/projects/gerritproject/', )
def test_create_project(self, mock_get_netrc_auth): mock_get_netrc_auth.return_value = ('user', 'password') req = mock.Mock() req.status_code = 201 req.content = ')]}\'{}'.encode('utf-8') call = mock.Mock() call.return_value = req reference = Gerrit(url='http://domain.com') reference.call = call with mock.patch.object(Project, 'get_project'): project = reference.create_project('gerritproject') call.assert_called_with( request='put', r_endpoint='/a/projects/gerritproject', r_payload={}, )
def test_create_project(self, mock_get_netrc_auth): mock_get_netrc_auth.return_value = ('user', 'password') req = mock.Mock() req.status_code = 201 req.content = ')]}\'{}'.encode('utf-8') call = mock.Mock() call.return_value = req reference = Gerrit(url='http://domain.com') reference.call = call with mock.patch.object(Project, 'get_project'): project = reference.create_project('gerritproject') call.assert_called_with( request='put', r_endpoint='/a/projects/gerritproject', r_payload={}, )