-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from lebouquetin/master
Allow to delete comments in a thread
- Loading branch information
Showing
13 changed files
with
302 additions
and
76 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
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
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import datetime | ||
|
||
from nose.tools import eq_ | ||
from nose.tools import ok_ | ||
|
||
import tracim.lib.helpers as h | ||
from tracim.model.data import Content | ||
from tracim.model.data import ContentType | ||
from tracim.model.data import Workspace | ||
|
||
from tracim.model.serializers import Context | ||
from tracim.model.serializers import CTX | ||
from tracim.model.serializers import DictLikeClass | ||
|
||
from tracim.tests import TestStandard | ||
|
||
|
||
|
||
class TestHelpers(TestStandard): | ||
|
||
def test_is_item_still_editable(self): | ||
item = DictLikeClass() | ||
|
||
h.CFG.DATA_UPDATE_ALLOWED_DURATION = 0 | ||
item.created = datetime.datetime.now() - datetime.timedelta(0, 10) | ||
eq_(False, h.is_item_still_editable(item)) | ||
|
||
h.CFG.DATA_UPDATE_ALLOWED_DURATION = -1 | ||
item.created = datetime.datetime.now() - datetime.timedelta(0, 10) | ||
eq_(True, h.is_item_still_editable(item)) | ||
|
||
h.CFG.DATA_UPDATE_ALLOWED_DURATION = 12 | ||
item.created = datetime.datetime.now() - datetime.timedelta(0, 10) | ||
eq_(True, h.is_item_still_editable(item), 'created: {}, now: {}'.format(item.created, datetime.datetime.now())) # This test will pass only if the test duration is less than 120s !!! | ||
|
||
h.CFG.DATA_UPDATE_ALLOWED_DURATION = 8 | ||
item.created = datetime.datetime.now() - datetime.timedelta(0, 10) | ||
eq_(False, h.is_item_still_editable(item)) |
Oops, something went wrong.