Skip to content

Commit

Permalink
Update tests to explicitly enable email where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmreed committed May 22, 2023
1 parent dd70a1f commit 9fd453b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
9 changes: 7 additions & 2 deletions metecho/api/tests/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,9 @@ def test_soft_deleted_model(self, scratch_org_factory):
pytest.param(fixture("task_with_project_factory"), id="Task with Project"),
),
)
def test_good(self, scratch_org_factory, _task_factory):
def test_good(self, scratch_org_factory, _task_factory, settings):
settings.EMAIL_ENABLED = True

scratch_org = scratch_org_factory(
unsaved_changes={"something": 1}, task=_task_factory()
)
Expand Down Expand Up @@ -913,7 +915,10 @@ def test_refreshes_commits(self, project_factory, epic_factory, task_factory):


@pytest.mark.django_db
def test_create_pr(mailoutbox, user_factory, task_factory, git_hub_user_factory):
def test_create_pr(
mailoutbox, user_factory, task_factory, git_hub_user_factory, settings
):
settings.EMAIL_ENABLED = True
user = user_factory()
task = task_factory(assigned_qa=git_hub_user_factory(id=user.github_id))
with ExitStack() as stack:
Expand Down
3 changes: 2 additions & 1 deletion metecho/api/tests/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,8 +853,9 @@ def test_queues_reassign(
assert user_reassign_job.delay.called

def test_try_send_assignment_emails(
self, auth_request, mailoutbox, git_hub_collaboration_factory, task
self, auth_request, mailoutbox, git_hub_collaboration_factory, task, settings
):
settings.EMAIL_ENABLED = True
git_hub_collaboration_factory(
permissions={"push": True},
project=task.root_project,
Expand Down
11 changes: 11 additions & 0 deletions test/js/components/epics/detail.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,17 @@ describe('<EpicDetail/>', () => {
});

describe('alerts assigned user', () => {
let EMAIL_ENABLED;

beforeAll(() => {
EMAIL_ENABLED = window.GLOBALS.EMAIL_ENABLED;
window.GLOBALS.EMAIL_ENABLED = true;
});

afterAll(() => {
window.GLOBALS.EMAIL_ENABLED = EMAIL_ENABLED;
});

test('assigning tester', () => {
const { getAllByText, baseElement, getByText } = setup();
fireEvent.click(getAllByText('Assign Tester')[0]);
Expand Down
11 changes: 11 additions & 0 deletions test/js/components/orgs/taskOrgCards.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,17 @@ describe('<TaskOrgCards/>', () => {
});

describe('Assign click', () => {
let EMAIL_ENABLED;

beforeAll(() => {
EMAIL_ENABLED = window.GLOBALS.EMAIL_ENABLED;
window.GLOBALS.EMAIL_ENABLED = true;
});

afterAll(() => {
window.GLOBALS.EMAIL_ENABLED = EMAIL_ENABLED;
});

test('updates assigned user', () => {
const task = {
...defaultTask,
Expand Down

0 comments on commit 9fd453b

Please sign in to comment.