def test_create_project(self, mock_new_resource): rm = RequestMaker('/api/v1', 'fakehost', 'faketoken') mock_new_resource.return_value = Project(rm) Projects(rm).create('PR 1', 'PR desc 1') mock_new_resource.assert_called_with( payload={'name': 'PR 1', 'description': 'PR desc 1'} )
def test_create_project(self, mock_new_resource): rm = RequestMaker("/api/v1", "fakehost", "faketoken") mock_new_resource.return_value = Project(rm) Projects(rm).create("PR 1", "PR desc 1") mock_new_resource.assert_called_with(payload={ "name": "PR 1", "description": "PR desc 1" })
def test_import_project(self, mock_requestmaker_post): rm = RequestMaker('/api/v1', 'fakehost', 'faketoken') roles = [{'name': 'Role 1'}] Projects(rm).import_('PR 1 1', 'PR 1 desc 1', roles) mock_requestmaker_post.assert_called_with( '/{endpoint}', payload={'description': 'PR 1 desc 1', 'name': 'PR 1 1', 'roles': [{'name': 'Role 1'}]}, endpoint='importer' )
def test_import_project(self, mock_requestmaker_post): rm = RequestMaker("/api/v1", "fakehost", "faketoken") roles = [{"name": "Role 1"}] Projects(rm).import_("PR 1 1", "PR 1 desc 1", roles) mock_requestmaker_post.assert_called_with( "/{endpoint}", payload={ "description": "PR 1 desc 1", "name": "PR 1 1", "roles": [{ "name": "Role 1" }] }, endpoint="importer", )
def my_method(self): response = self.requester.get('/users/{id}/starred', id=self.id) return Projects.parse(response.json(), self.requester)