def testCreateNewBug(self):
        retClass = Bug
        resp = self._robj([
            '_id', 'title', '_status_id', '_severity_id',
            '_project_version_id', '_project_section_id', '_type_id',
            '_reproducibility_id', '_priority_id', '_assigned_user_id',
            'description', 'expected_results'
        ])
        self._client.debugReturn = {'data': json.dumps(resp), 'status': 200}

        obj = Project(self._client, {
            'id': 0
        }).bugs.create({
            'title': '',
            'status_id': 0,
            'severity_id': 0,
            'project_version_id': 0,
            'project_section_id': 0,
            'type_id': 0,
            'reproducibility_id': 0,
            'priority_id': 0,
            'assigned_user_id': 0,
            'description': '',
            'expected_results': ''
        })

        self.assertEqual(resp, obj.data)
        self.assertIsInstance(obj, retClass)
    def testAddProjectVersion(self):
        retClass = ProjectVersion
        resp = self._robj(['_id', 'number', '_project_id'])
        self._client.debugReturn = {'data': json.dumps(resp), 'status': 200}

        obj = Project(self._client, {'id': 0}).versions.create({'number': ''})

        self.assertEqual(resp, obj.data)
        self.assertIsInstance(obj, retClass)
Пример #3
0
	def create(self, fields):
		super().create(fields)

		supports = {
			'name'            : True,
			'organization_id' : False
		}

		if self.enforce(fields, supports):
			req = APIRequest(self._origin, '/v1/projects', 'POST', {'params': fields})
			return Project(self._origin, req.exec_())
Пример #4
0
	def testListProjectBugPriorityScheme(self):
		colName = 'scheme'
		retClass = ProjectBugScheme
		resp = self._rcol(colName, ['_id', 'name'])
		self._client.debugReturn = {'data': json.dumps(resp), 'status': 200}

		col = Project(self._client, {'id': 0}).bugPriorityScheme.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())
Пример #5
0
	def testListProjectUsers(self):
		colName = 'users'
		retClass = ProjectUser
		resp = self._rcol(colName, ['_id', 'username', 'first_name', 'last_name', 'avatar', 'email', 'created_at'])
		self._client.debugReturn = {'data': json.dumps(resp), 'status': 200}

		col = Project(self._client, {'id': 0}).users.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())
Пример #6
0
	def testListProjectVersions(self):
		colName = 'versions'
		retClass = ProjectVersion
		resp = self._rcol(colName, ['_id', 'number', '_project_id'])
		self._client.debugReturn = {'data': json.dumps(resp), 'status': 200}

		col = Project(self._client, {'id': 0}).versions.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())
Пример #7
0
	def testListBugsInProject(self):
		colName = 'bugs'
		retClass = Bug
		resp = self._rcol(colName, ['_id', 'title', '_status_id', '_severity_id', '_project_version_id',
			'_project_section_id', '_type_id', '_reproducibility_id', '_priority_id', '_assigned_user_id', 'description',
			'expected_results'])
		self._client.debugReturn = {'data': json.dumps(resp), 'status': 200}

		col = Project(self._client, {'id': 0}).bugs.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())
Пример #8
0
	def find(self, id_):
		super().find(id_)

		req = APIRequest(self._origin, '/v1/projects/' + str(id_), 'GET')
		return Project(self._origin, req.exec_())