Skip to content

Commit

Permalink
Fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zmitchell committed Aug 4, 2018
1 parent 87be495 commit f0f7ad2
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/test_notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def __init__(self):
def test_intercepts_inst_writes(mocker):
"""#SPC-notify-intercept.tst-intercepts_inst"""
# Pretend like the user rejected the new value
mocker.patch("annotation_abuse.notify.prompt_user", lambda: False)
mocker.patch("annotation_abuse.notify.prompt_user", lambda: Response.NO)

@notify
class DummyClass(object):
Expand All @@ -104,15 +104,15 @@ def __init__(self):
# Write (hopefully) intercepted and rejected
assert dummy.var == 1
# Make sure the behavior responds to the user prompt
mocker.patch("annotation_abuse.notify.prompt_user", lambda: True)
mocker.patch("annotation_abuse.notify.prompt_user", lambda: Response.YES)
dummy.var = 2
assert dummy.var == 2


def test_intercepts_class_writes(mocker):
"""#SPC-notify-intercept.tst-intercepts_class"""
# Pretend like the user rejected the new value
mocker.patch("annotation_abuse.notify.prompt_user", lambda: False)
mocker.patch("annotation_abuse.notify.prompt_user", lambda: Response.NO)

@notify
class DummyClass(object):
Expand All @@ -124,15 +124,15 @@ class DummyClass(object):
# Write (hopefully) intercepted and rejected
assert dummy.var == 1
# Make sure the behavior responds to the user prompt
mocker.patch("annotation_abuse.notify.prompt_user", lambda: True)
mocker.patch("annotation_abuse.notify.prompt_user", lambda: Response.YES)
dummy.var = 2
assert dummy.var == 2


def test_unmarked_inst_still_write(mocker):
"""#SPC-notify-inst.tst-unmarked_inst"""
"""#SPC-notify-intercept.tst-unmarked_inst"""
# Pretend like the user rejected the new value
mocker.patch("annotation_abuse.notify.prompt_user", lambda: False)
mocker.patch("annotation_abuse.notify.prompt_user", lambda: Response.NO)

@notify
class DummyClass(object):
Expand All @@ -145,15 +145,15 @@ def __init__(self):
# Write (hopefully) intercepted and rejected
assert dummy.var == 2
# Make sure the behavior responds to the user prompt
mocker.patch("annotation_abuse.notify.prompt_user", lambda: True)
mocker.patch("annotation_abuse.notify.prompt_user", lambda: Response.YES)
dummy.var = 3
assert dummy.var == 3


def test_unmarked_class_still_write(mocker):
"""#SPC-notify-inst.tst-unmarked_class"""
"""#SPC-notify-intercept.tst-unmarked_class"""
# Pretend like the user rejected the new value
mocker.patch("annotation_abuse.notify.prompt_user", lambda: False)
mocker.patch("annotation_abuse.notify.prompt_user", lambda: Response.NO)

@notify
class DummyClass(object):
Expand All @@ -165,7 +165,7 @@ class DummyClass(object):
# Write (hopefully) intercepted and rejected
assert dummy.var == 2
# Make sure the behavior responds to the user prompt
mocker.patch("annotation_abuse.notify.prompt_user", lambda: True)
mocker.patch("annotation_abuse.notify.prompt_user", lambda: Response.YES)
dummy.var = 3
assert dummy.var == 3

Expand Down

0 comments on commit f0f7ad2

Please sign in to comment.