Exemple #1
0
 def test_sees_log_events_on_watched_projects(self):
     # Another user has a public project
     u2 = UserFactory(username='******', fullname='Bono')
     key = ApiKeyFactory()
     u2.api_keys.append(key)
     u2.save()
     project = ProjectFactory(creator=u2, is_public=True)
     project.add_contributor(u2)
     auth = Auth(user=u2, api_key=key)
     # A file was added to the project
     project.add_file(auth=auth,
                      file_name='test.html',
                      content='123',
                      size=2,
                      content_type='text/html')
     project.save()
     # User watches the project
     watch_config = WatchConfigFactory(node=project)
     self.user.watch(watch_config)
     self.user.save()
     # Goes to her dashboard, already logged in
     res = self.app.get('/dashboard/', auth=self.auth, auto_follow=True)
     # Sees logs for the watched project
     assert_in('Watched Projects', res)  # Watched Projects header
     # The log action is in the feed
     assert_in('added file test.html', res)
     assert_in(project.title, res)
Exemple #2
0
 def test_watch_adds_to_watched_list(self):
     n_watched_then = len(self.user.watched)
     # A user watches a WatchConfig
     config = WatchConfigFactory(node=self.project)
     self.user.watch(config)
     n_watched_now = len(self.user.watched)
     assert_equal(n_watched_now, n_watched_then + 1)
     assert_true(self.user.is_watching(self.project))
Exemple #3
0
 def test_unwatch_removes_from_watched_list(self):
     # The user has already watched a project
     self._watch_project(self.project)
     config = WatchConfigFactory(node=self.project)
     n_watched_then = len(self.user.watched)
     self.user.unwatch(config)
     n_watched_now = len(self.user.watched)
     assert_equal(n_watched_now, n_watched_then - 1)
     assert_false(self.user.is_watching(self.project))
Exemple #4
0
 def test_sees_log_events_on_watched_projects(self):
     # Another user has a public project
     u2 = UserFactory(username='******', fullname='Bono')
     project = ProjectFactory(creator=u2, is_public=True)
     project.add_contributor(u2)
     auth = Auth(user=u2)
     project.save()
     # User watches the project
     watch_config = WatchConfigFactory(node=project)
     self.user.watch(watch_config)
     self.user.save()
     # Goes to her dashboard, already logged in
     res = self.app.get('/dashboard/', auth=self.auth, auto_follow=True)
     # Sees logs for the watched project
     assert_in('Watched Projects', res)  # Watched Projects header
     # The log action is in the feed
     assert_in(project.title, res)
Exemple #5
0
 def _unwatch_project(self, project):
     watch_config = WatchConfigFactory(node=project)
     self.user.watch(watch_config)
     self.user.save()