-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a448a03
commit 15d91b6
Showing
5 changed files
with
82 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ def mockup(cls): | |
email='[email protected]', | ||
access_token='access token', | ||
phone=123456789, | ||
reference_id=2 | ||
reference_id=2, | ||
) | ||
|
||
workflow = Workflow(title='Default') | ||
|
@@ -43,13 +43,15 @@ def mockup(cls): | |
manager=cls.member1, | ||
title='My first project', | ||
description='A decription for my project', | ||
room_id=1001 | ||
room_id=1001, | ||
) | ||
session.add(cls.project1) | ||
session.commit() | ||
|
||
cls.batch1 = Batch(title='01') | ||
cls.batch1 = Batch(title='002') | ||
cls.batch2 = Batch(title='003') | ||
cls.project1.batches.append(cls.batch1) | ||
cls.project1.batches.append(cls.batch2) | ||
|
||
with Context(dict()): | ||
context.identity = cls.member1 | ||
|
@@ -59,26 +61,36 @@ def mockup(cls): | |
description='This is description of first issue', | ||
kind='feature', | ||
days=1, | ||
room_id=2 | ||
room_id=2, | ||
) | ||
cls.issue2 = Issue( | ||
title='second issue', | ||
description='This is description of second issue', | ||
kind='feature', | ||
days=1, | ||
room_id=2, | ||
) | ||
|
||
cls.project1.issues.append(cls.issue1) | ||
cls.project1.issues.append(cls.issue2) | ||
session.commit() | ||
|
||
def test_append(self): | ||
session = self.create_session() | ||
self.login('[email protected]') | ||
title = '010' | ||
|
||
with oauth_mockup_server(), self.given( | ||
'Appending a batch', | ||
f'/apiv1/batches/id: {self.batch1.id}', | ||
f'/apiv1/batches/id: {title}', | ||
'APPEND', | ||
json=dict( | ||
issueIds=self.issue1.id | ||
) | ||
): | ||
assert status == 200 | ||
assert response.json['id'] is not None | ||
assert response.json['title'] == self.batch1.title | ||
assert response.json['title'] == title | ||
assert response.json['projectId'] == self.project1.id | ||
assert self.issue1.id in response.json['issueIds'] | ||
assert len(response.json['issueIds']) == 1 | ||
|
@@ -109,9 +121,9 @@ def test_append(self): | |
|
||
when( | ||
'Inended batch with integer type not found', | ||
url_parameters=dict(id=0) | ||
url_parameters=dict(id=101) | ||
) | ||
assert status == 404 | ||
assert status == '936 Invalid Batch More Than 100' | ||
|
||
when( | ||
'Inended batch with string type not found', | ||
|
@@ -122,3 +134,25 @@ def test_append(self): | |
when('Request is not authorized', authorization=None) | ||
assert status == 401 | ||
|
||
session = self.create_session() | ||
assert session.query(Batch) \ | ||
.filter(Batch.project_id == self.project1.id) \ | ||
.order_by(Batch.id.desc()) \ | ||
.first() != self.batch2 | ||
|
||
with oauth_mockup_server(), self.given( | ||
'Appending a batch', | ||
f'/apiv1/batches/id: {self.batch1.title}', | ||
'APPEND', | ||
json=dict( | ||
issueIds=self.issue2.id | ||
) | ||
): | ||
assert status == 200 | ||
assert response.json['id'] is not None | ||
assert response.json['title'] == self.batch1.title | ||
assert response.json['projectId'] == self.project1.id | ||
assert self.issue2.id in response.json['issueIds'] | ||
assert len(response.json['issueIds']) == 1 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters