Esempio n. 1
0
    def update(self, id_, fields):
        super().update(id_, fields)

        supports = {
            'title': False,
            'status_id': False,
            'severity_id': False,
            'priority_id': False,
            'project_version_id': False,
            'project_section_id': False,
            'type_id': False,
            'assigned_user_id': False,
            'description': False,
            'expected_results': False,
            'steps': False,
            'platform': False
            # 'device_model'       : False,
            # 'device_model_id'    : False,
            # 'os'                 : False,
            # 'os_version'         : False,
            # 'os_version_id'      : False,
            # 'browser_version_id' : False
        }

        if self.enforce(fields, supports):
            initFields = {'include': 'steps,platform'}
            initFields.update(fields)
            fields = initFields

            req = APIRequest(self._origin, '/v1/bugs/' + str(id_), 'PUT',
                             {'params': fields})
            return Bug(self._origin, req.exec_())
Esempio n. 2
0
    def find(self, id_):
        super().find(id_)

        req = APIRequest(self._origin, '/v1/bugs/' + str(id_), 'GET', {
            'params': {
                'include': 'steps,platform,attachments,comments,tags'
            }
        })
        return Bug(self._origin, req.exec_())
    def find(self, id_, params=None):
        super().find(id_)

        if params is None:
            params = {}

        req = APIRequest(self._origin, '/v1/bugs/' + str(id_), 'GET',
                         {'params': params})
        return Bug(self._origin, req.exec_())
Esempio n. 4
0
	def testCreateNewAttachment(self):
		retClass = BugAttachment
		resp = self._robj(['_id', '_owner_id', 'url', 'created_at'])
		self._client.debugReturn = {'data': json.dumps(resp), 'status': 200}

		_fp = os.path.dirname(os.path.realpath(__file__)) + '/res/upload_sample.jpg'
		obj = Bug(self._client, {'id': 0}).attachments.upload(_fp)

		self.assertEqual(resp, obj.data)
		self.assertIsInstance(obj, retClass)
Esempio n. 5
0
	def testListBugAttachments(self):
		colName = 'attachments'
		retClass = BugAttachment
		resp = self._rcol(colName, ['_id', '_owner_id', 'url', 'created_at'])
		self._client.debugReturn = {'data': json.dumps(resp), 'status': 200}

		col = Bug(self._client, {'id': 0}).attachments.all()

		self.assertEqual(resp[colName], col.toArray())
		self.assertIsInstance(col._collection[0], retClass)
		self.assertEqual(resp['meta']['pagination']['total'], col.total())
		self.assertEqual(resp['meta']['pagination']['total_pages'], col.totalPages())
		self.assertEqual(resp['meta']['pagination']['count'], col.count())
    def create(self, fields):
        super().create(fields)

        supports = {
            'title': True,
            'status_id': True,
            'severity_id': True,
            'project_version': True,
            'project_version_id': True,
            'project_section_id': False,
            'type_id': False,
            'reproducibility_id': False,
            'priority_id': False,
            'assigned_user_id': False,
            'description': False,
            'expected_results': False,
            'steps': False,
            'platform': False
            # 'device_model'       : False,
            # 'device_model_id'    : False,
            # 'os'                 : False,
            # 'os_version'         : False,
            # 'os_version_id'      : False,
            # 'browser_version_id' : False
        }

        if 'project_version_id' in fields.keys():
            supports['project_version'] = False
        elif 'project_version' in fields.keys():
            supports['project_version_id'] = False

        if self.enforce(fields, supports):
            initFields = {'include': 'steps,platform'}
            initFields.update(fields)
            fields = initFields

            req = APIRequest(self._origin,
                             '/v1/projects/' + str(self._projectID) + '/bugs',
                             'POST', {'params': fields})

            return Bug(self._origin, req.exec_())