Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: remove duplicate tests #120

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions tests/integration/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,20 +336,6 @@ def test_get_auth_token_error_inactive_user(client, settings):
assert response.status_code == 401, response.data


def test_get_auth_token_error_inactive_user(client, settings):
settings.PUBLIC_REGISTER_ENABLED = False
user = factories.UserFactory(is_active=False)

auth_data = {
"username": user.username,
"password": user.username,
"type": "normal",
}

response = client.post(reverse("auth-list"), auth_data)

assert response.status_code == 401, response.data

def test_get_auth_token_error_system_user(client, settings):
settings.PUBLIC_REGISTER_ENABLED = False
user = factories.UserFactory(is_system=True)
Expand Down
30 changes: 0 additions & 30 deletions tests/integration/test_hooks_bitbucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,36 +556,6 @@ def test_push_event_task_bad_processing_non_existing_ref(client):
assert len(mail.outbox) == 0


def test_push_event_task_bad_processing_non_existing_ref(client):
issue_status = f.IssueStatusFactory()
payload = {
"actor": {
"user": {
"uuid": "{ce1054cd-3f43-49dc-8aea-d3085ee7ec9b}",
"username": "test-user",
"links": {"html": {"href": "http://bitbucket.com/test-user"}}
}
},
"push": {
"changes": [
{
"commits": [
{ "message": "test message test TG-6666666 #%s ok bye!" % (issue_status.slug) }
]
}
]
}
}
mail.outbox = []

ev_hook = event_hooks.PushEventHook(issue_status.project, payload)
with pytest.raises(ActionSyntaxException) as excinfo:
ev_hook.process_event()

assert str(excinfo.value) == "The referenced element doesn't exist"
assert len(mail.outbox) == 0


def test_push_event_us_bad_processing_non_existing_status(client):
user_story = f.UserStoryFactory.create()
payload = {
Expand Down
30 changes: 0 additions & 30 deletions tests/integration/test_hooks_gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,36 +1095,6 @@ def test_issues_event_opened_issue_connected_with_external_one(client):
assert issue.status == issue.project.default_issue_status


def test_issues_event_updated_issue_without_connection(client):
issue = f.IssueFactory.create(external_reference=[])
issue.project.default_issue_status = issue.status
issue.project.default_issue_type = issue.type
issue.project.default_severity = issue.severity
issue.project.default_priority = issue.priority
issue.project.save()
Membership.objects.create(user=issue.owner, project=issue.project, role=f.RoleFactory.create(project=issue.project), is_admin=True)
notify_policy = NotifyPolicy.objects.get(user=issue.owner, project=issue.project)
notify_policy.notify_level = NotifyLevel.all
notify_policy.save()

payload = deepcopy(close_issue_base_payload)
payload["object_attributes"]["url"] = "http://gitlab.com/test/project/issues/112"
payload["object_attributes"]["state"] = "opened"
payload["object_attributes"]["action"] = "reopen"

mail.outbox = []

assert Issue.objects.count() == 1

ev_hook = event_hooks.IssuesEventHook(issue.project, payload)
ev_hook.process_event()

assert Issue.objects.count() == 2
assert len(mail.outbox) == 1

assert Issue.objects.all().order_by("id").last().status == issue.project.default_issue_status


#
# ISSUE EVENTS: CLOSE
#
Expand Down
9 changes: 0 additions & 9 deletions tests/integration/test_memberships.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,15 +731,6 @@ def test_api_edit_membership(client):
assert response.status_code == 200


def test_api_edit_membership(client):
membership = f.MembershipFactory(is_admin=True)
client.login(membership.user)
url = reverse("memberships-detail", args=[membership.id])
data = {"username": "[email protected]"}
response = client.json.patch(url, json.dumps(data))
assert response.status_code == 200


def test_api_change_owner_membership_to_no_admin_return_error(client):
project = f.ProjectFactory()
membership_owner = f.MembershipFactory(project=project, user=project.owner, is_admin=True)
Expand Down
83 changes: 0 additions & 83 deletions tests/integration/test_userstories_update_backlog_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,89 +609,6 @@ def test_api_update_orders_in_bulk_invalid_after_us_because_no_milestone(client)
assert "after_userstory_id" in response.data


def test_api_update_orders_in_bulk_invalid_after_us_because_project(client):
project = f.create_project()
f.MembershipFactory.create(project=project, user=project.owner, is_admin=True)
us1 = f.create_userstory(project=project)
us2 = f.create_userstory(project=project)
us3 = f.create_userstory(project=project)
us4 = f.create_userstory()

url = reverse("userstories-bulk-update-backlog-order")

data = {
"project_id": project.id,
"before_userstory_id": us4.id,
"bulk_userstories": [us1.id,
us2.id,
us3.id]
}

client.login(project.owner)

response = client.json.post(url, json.dumps(data))
assert response.status_code == 400, response.data
assert len(response.data) == 1
assert "before_userstory_id" in response.data


def test_api_update_orders_in_bulk_invalid_after_us_because_milestone(client):
project = f.create_project()
f.MembershipFactory.create(project=project, user=project.owner, is_admin=True)
milestone = f.MilestoneFactory.create(project=project)
milestone2 = f.MilestoneFactory.create(project=project)
us1 = f.create_userstory(project=project)
us2 = f.create_userstory(project=project)
us3 = f.create_userstory(project=project)
us4 = f.create_userstory(project=project, milestone=milestone2)

url = reverse("userstories-bulk-update-backlog-order")

data = {
"project_id": project.id,
"milestone_id": milestone.id,
"before_userstory_id": us4.id,
"bulk_userstories": [us1.id,
us2.id,
us3.id]
}

client.login(project.owner)

response = client.json.post(url, json.dumps(data))
assert response.status_code == 400, response.data
assert len(response.data) == 1
assert "before_userstory_id" in response.data


def test_api_update_orders_in_bulk_invalid_after_us_because_no_milestone(client):
project = f.create_project()
f.MembershipFactory.create(project=project, user=project.owner, is_admin=True)
milestone = f.MilestoneFactory.create(project=project)
us1 = f.create_userstory(project=project)
us2 = f.create_userstory(project=project)
us3 = f.create_userstory(project=project)
us4 = f.create_userstory(project=project, milestone=None)

url = reverse("userstories-bulk-update-backlog-order")

data = {
"project_id": project.id,
"milestone_id": milestone.id,
"before_userstory_id": us4.id,
"bulk_userstories": [us1.id,
us2.id,
us3.id]
}

client.login(project.owner)

response = client.json.post(url, json.dumps(data))
assert response.status_code == 400, response.data
assert len(response.data) == 1
assert "before_userstory_id" in response.data


def test_api_update_orders_in_bulk_invalid_before_us_because_after_us_exist(client):
project = f.create_project()
f.MembershipFactory.create(project=project, user=project.owner, is_admin=True)
Expand Down