def setUp(self): self.url = URL self.redmine = Redmine(self.url) self.response = mock.Mock(status_code=200, json=json_response(response)) patcher = mock.patch('requests.get', return_value=self.response) patcher.start() self.addCleanup(patcher.stop)
def test_set_attributes_through_kwargs(self): self.redmine = Redmine( self.url, key='123', version='1.0', username='******', password='******', impersonate='jsmith', date_format='format', datetime_format='format', requests={'foo': 'bar'}, raise_attr_exception=False, custom_resource_paths='foo.bar.baz' ) self.assertEqual(self.redmine.url, self.url) self.assertEqual(self.redmine.key, '123') self.assertEqual(self.redmine.ver, '1.0') self.assertEqual(self.redmine.username, 'john') self.assertEqual(self.redmine.password, 'qwerty') self.assertEqual(self.redmine.impersonate, 'jsmith') self.assertEqual(self.redmine.date_format, 'format') self.assertEqual(self.redmine.datetime_format, 'format') self.assertEqual(self.redmine.requests['foo'], 'bar') self.assertEqual(self.redmine.raise_attr_exception, False) self.assertEqual(self.redmine.custom_resource_paths, 'foo.bar.baz')
def setUp(self): self.url = URL self.redmine = Redmine(self.url) self.response = mock.Mock() patcher_get = mock.patch('requests.get', return_value=self.response) patcher_post = mock.patch('requests.post', return_value=self.response) patcher_put = mock.patch('requests.put', return_value=self.response) patcher_get.start() patcher_post.start() patcher_put.start() self.addCleanup(patcher_get.stop) self.addCleanup(patcher_post.stop) self.addCleanup(patcher_put.stop)
def setUp(self): self.url = URL self.redmine = Redmine(self.url) self.response = mock.Mock(status_code=200, json=mock.Mock(return_value=response)) patcher_get = mock.patch('redmine.requests.get', return_value=self.response) patcher_put = mock.patch('redmine.requests.put', return_value=self.response) patcher_delete = mock.patch('redmine.requests.delete', return_value=self.response) patcher_get.start() patcher_put.start() patcher_delete.start() self.addCleanup(patcher_get.stop) self.addCleanup(patcher_put.stop) self.addCleanup(patcher_delete.stop)
def setUp(self): self.url = URL self.redmine = Redmine(self.url)