Browse Source

fixes tests

Damien ACCORSI 9 years ago
parent
commit
8f75ce798f

+ 4 - 1
tracim/tracim/lib/workspace.py View File

@@ -45,7 +45,10 @@ class WorkspaceApi(object):
45 45
         workspace.description = description
46 46
 
47 47
         # By default, we force the current user to be the workspace manager
48
-        role = RoleApi(self._user).create_one(self._user, workspace, UserRoleInWorkspace.WORKSPACE_MANAGER)
48
+        # And to receive email notifications
49
+        role = RoleApi(self._user).create_one(self._user, workspace,
50
+                                              UserRoleInWorkspace.WORKSPACE_MANAGER,
51
+                                              with_notif=True)
49 52
 
50 53
         DBSession.add(workspace)
51 54
         DBSession.add(role)

+ 4 - 0
tracim/tracim/tests/library/test_content_api.py View File

@@ -342,6 +342,7 @@ class TestContentApi(TestStandard):
342 342
 
343 343
         RoleApi(user1).create_one(user2, workspace,
344 344
                                   UserRoleInWorkspace.CONTENT_MANAGER,
345
+                                  with_notif=False,
345 346
                                   flush=True)
346 347
 
347 348
         # Test starts here
@@ -405,6 +406,7 @@ class TestContentApi(TestStandard):
405 406
 
406 407
         RoleApi(user1).create_one(user2, workspace,
407 408
                                   UserRoleInWorkspace.CONTENT_MANAGER,
409
+                                  with_notif=True,
408 410
                                   flush=True)
409 411
 
410 412
         # Test starts here
@@ -471,6 +473,7 @@ class TestContentApi(TestStandard):
471 473
 
472 474
         RoleApi(user1).create_one(user2, workspace,
473 475
                                   UserRoleInWorkspace.CONTENT_MANAGER,
476
+                                  with_notif=True,
474 477
                                   flush=True)
475 478
 
476 479
         # show archived is used at the top end of the test
@@ -545,6 +548,7 @@ class TestContentApi(TestStandard):
545 548
 
546 549
         RoleApi(user1).create_one(user2, workspace,
547 550
                                   UserRoleInWorkspace.CONTENT_MANAGER,
551
+                                  with_notif=True,
548 552
                                   flush=True)
549 553
 
550 554
         # show archived is used at the top end of the test

+ 6 - 0
tracim/tracim/tests/library/test_helpers.py View File

@@ -25,9 +25,15 @@ class TestHelpers(TestStandard):
25 25
 
26 26
         h.CFG.DATA_UPDATE_ALLOWED_DURATION = 0
27 27
         item.created = datetime.datetime.now() - datetime.timedelta(0, 10)
28
+
29
+        item.type = DictLikeClass({'id': 5})
30
+        eq_(False, h.is_item_still_editable(item))
31
+
32
+        item.type.id = 'comment'
28 33
         eq_(False, h.is_item_still_editable(item))
29 34
 
30 35
         h.CFG.DATA_UPDATE_ALLOWED_DURATION = -1
36
+        item.type.id = 'comment'
31 37
         item.created = datetime.datetime.now() - datetime.timedelta(0, 10)
32 38
         eq_(True, h.is_item_still_editable(item))
33 39