示例#1
0
 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'}
     )
示例#2
0
 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"
     })
示例#3
0
 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'
     )
示例#4
0
 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",
     )
示例#5
0
 def my_method(self):
     response = self.requester.get('/users/{id}/starred', id=self.id)
     return Projects.parse(response.json(), self.requester)