Add test filter assigned users by role
parent
8e01fbc97b
commit
5974ca6ce3
|
@ -716,6 +716,34 @@ def test_api_filter_by_assigned_users(client):
|
||||||
assert number_of_userstories == 2
|
assert number_of_userstories == 2
|
||||||
|
|
||||||
|
|
||||||
|
def test_api_filter_by_role(client):
|
||||||
|
project = f.ProjectFactory.create()
|
||||||
|
role1 = f.RoleFactory.create()
|
||||||
|
|
||||||
|
user = f.UserFactory(is_superuser=True)
|
||||||
|
user2 = f.UserFactory(is_superuser=True)
|
||||||
|
f.MembershipFactory.create(user=user2, project=project, role=role1)
|
||||||
|
|
||||||
|
userstory = f.create_userstory(owner=user, subject="test 2 users",
|
||||||
|
assigned_to=user,
|
||||||
|
assigned_users=[user.id, user2.id],
|
||||||
|
project=project)
|
||||||
|
f.create_userstory(
|
||||||
|
owner=user, subject="test 1 user", assigned_to=user,
|
||||||
|
assigned_users=[user.id],
|
||||||
|
project=project
|
||||||
|
)
|
||||||
|
|
||||||
|
url = reverse("userstories-list") + "?role=%s" % (role1.id)
|
||||||
|
|
||||||
|
client.login(userstory.owner)
|
||||||
|
response = client.get(url)
|
||||||
|
number_of_userstories = len(response.data)
|
||||||
|
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert number_of_userstories == 1
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("field_name", ["estimated_start", "estimated_finish"])
|
@pytest.mark.parametrize("field_name", ["estimated_start", "estimated_finish"])
|
||||||
def test_api_filter_by_milestone__estimated_start_and_end(client, field_name):
|
def test_api_filter_by_milestone__estimated_start_and_end(client, field_name):
|
||||||
user = f.UserFactory(is_superuser=True)
|
user = f.UserFactory(is_superuser=True)
|
||||||
|
|
Loading…
Reference in New Issue