Exemplo n.º 1
0
 def test_search(self):
     project = test_data.create_dummy_project()
     test_data.create_dummy_issue(project, title='One')
     test_data.create_dummy_issue(project, title='Two')
     test_data.create_dummy_issue(project, title='Three')
     test_data.create_dummy_issue(project, title='Four')
     response = self.client.get('/search/')
     self.assertEqual(response.status_code, 200)
     self.assertEqual(4, len(response.context['issues']))
    def test_watch_toggle_issue(self):
        issue = test_data.create_dummy_issue()
        user = issue.createdByUser

        self.assertTrue(not watch_services.is_watching_issue(user, issue.id))

        watch_services.watch_issue(user, issue.id, IssueWatch.WATCHED)
        self.assertTrue(watch_services.is_watching_issue(user, issue.id))

        watch_services.unwatch_issue(user, issue.id)
        self.assertTrue(not watch_services.is_watching_issue(user, issue.id))
    def test_watch_toggle_issue(self):
        issue = test_data.create_dummy_issue()
        user = issue.createdByUser

        self.assertTrue(not watch_services.is_watching_issue(user, issue.id))

        watch_services.watch_issue(user, issue.id, Watch.WATCHED)
        self.assertTrue(watch_services.is_watching_issue(user, issue.id))

        watch_services.toggle_watch(user, 'ISSUE', issue.id, Watch.WATCHED)
        self.assertTrue(not watch_services.is_watching_issue(user, issue.id))
    def test_watch_unwatch_issue(self):
        issue = test_data.create_dummy_issue()
        self.assertTrue(not watch_services.is_watching_issue(self.user, issue.id))

        response = self.client.get(_reverse('watchIssue', issue_id=issue.id))
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.content, 'WATCHING')
        self.assertTrue(watch_services.is_watching_issue(self.user, issue.id))

        response = self.client.get(_reverse('unwatchIssue', issue_id=issue.id))
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.content, 'NOT_WATCHING')
        self.assertTrue(not watch_services.is_watching_issue(self.user, issue.id))
    def test_watch_unwatch_issue(self):
        issue = test_data.create_dummy_issue()
        self.assertTrue(not watch_services.is_watching_issue(self.user, issue.id))

        response = self.client.get('/core/watch/issue/%s'%issue.id)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.content, 'WATCHING')
        self.assertTrue(watch_services.is_watching_issue(self.user, issue.id))

        response = self.client.get('/core/unwatch/issue/%s'%issue.id)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.content, 'NOT_WATCHING')
        self.assertTrue(not watch_services.is_watching_issue(self.user, issue.id))
    def test_watch_unwatch_issue(self):
        issue = test_data.create_dummy_issue()
        self.assertTrue(not watch_services.is_watching_issue(self.user, issue.id))

        response = self.client.post('/core/json/toggle_watch', {'entity': 'ISSUE', 'objid': issue.id})
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.content, 'WATCHING')
        self.assertTrue(watch_services.is_watching_issue(self.user, issue.id))

        response = self.client.post('/core/json/toggle_watch', {'entity': 'ISSUE', 'objid': issue.id})
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.content, 'NOT_WATCHING')
        self.assertTrue(not watch_services.is_watching_issue(self.user, issue.id))
    def test_watch_unwatch_issue(self):
        issue = test_data.create_dummy_issue()
        self.assertTrue(
            not watch_services.is_watching_issue(self.user, issue.id))

        response = self.client.get('/core/watch/issue/%s' % issue.id)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.content, 'WATCHING')
        self.assertTrue(watch_services.is_watching_issue(self.user, issue.id))

        response = self.client.get('/core/unwatch/issue/%s' % issue.id)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.content, 'NOT_WATCHING')
        self.assertTrue(
            not watch_services.is_watching_issue(self.user, issue.id))
    def test_watch_unwatch_issue(self):
        issue = test_data.create_dummy_issue()
        self.assertTrue(
            not watch_services.is_watching_issue(self.user, issue.id))

        response = self.client.post('/core/json/toggle_watch', {
            'entity': 'ISSUE',
            'objid': issue.id
        })
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.content, 'WATCHING')
        self.assertTrue(watch_services.is_watching_issue(self.user, issue.id))

        response = self.client.post('/core/json/toggle_watch', {
            'entity': 'ISSUE',
            'objid': issue.id
        })
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.content, 'NOT_WATCHING')
        self.assertTrue(
            not watch_services.is_watching_issue(self.user, issue.id))
 def test_unwatch_issue(self):
     issue = test_data.create_dummy_issue()
     self.assert_permanent_redirect(_reverse('unwatchIssue', issue_id=issue.id),
         '/core/unwatch/issue/%s' % issue.id)
 def setUp(self):
     self.project = test_data.create_dummy_project()
     self.issue = test_data.create_dummy_issue(project=self.project)
     self.offer = test_data.create_dummy_offer_usd(issue=self.issue)
     self.issue.update_redundant_fields()
     self.client = Client()
Exemplo n.º 11
0
 def setUp(self):
     self.project = test_data.create_dummy_project()
     self.issue = test_data.create_dummy_issue(project=self.project)
     self.offer = test_data.create_dummy_offer_usd(issue=self.issue)
     self.issue.update_redundant_fields()
     self.client = Client()