Ejemplo n.º 1
0
 def test_unfollow(self):
     login_user(self.client, 'test0', 'test')
     url = '/timeline/test1'
     self.test_follow()
     response = self.client.get('/unfollow/test1/')
     self.assertFalse(
         Follower.objects.filter(
             who=User.objects.get_by_natural_key('test0'),
             whom=User.objects.get_by_natural_key('test1')).exists())
     self.assertEqual(response.status_code, 302)
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
     self.assertContains(response,
                         'You are not yet following this user.',
                         count=1)
Ejemplo n.º 2
0
 def setUp(self):
     self.user = login_user(self)
     self.event = get_or_create_event(self.c, self.user)
     # self.add_url = reverse('entries:add',
     #                       kwargs={'event': self.event.pk})
     self.list_url = reverse('entries:entries',
                             kwargs={'event': self.event.pk})
Ejemplo n.º 3
0
 def setUp(self):
     self.user = login_user(self)
     self.event = get_or_create_event(self.c, self.user)
     self.lead = LeadTestCase().get_or_create_lead()
     self.add_url = reverse('leads:add_sos',
                            kwargs={'event': self.event.pk,
                                    'lead_id': self.lead.pk})
     self.list_url = reverse('leads:sos',
                             kwargs={'event': self.event.pk})
Ejemplo n.º 4
0
    def test_personal_timeline_includes_followed(self):
        url = reverse('personal_timeline')

        def count_messages_per_user(counts):
            response = self.client.get(url)
            self.assertEqual(response.status_code, 200)
            for k, v in counts.items():
                self.assertContains(response, k, count=v)

        def messages_content(msgs):
            response = self.client.get(url)
            self.assertEqual(response.status_code, 200)
            for msg in msgs:
                self.assertContains(response, msg.text, count=1)

        login_user(self.client, 'test0', 'test')
        counts = {'test0': 10, 'test1': 0, 'test2': 0}
        count_messages_per_user(counts)
        self.test_follow()
        counts['test1'] = 6
        count_messages_per_user(counts)
        messages = self.messages['user0'] + self.messages['user1']
        messages_content(messages)
Ejemplo n.º 5
0
 def setUp(self):
     self.user = login_user(self)
     self.event = get_or_create_event(self.c, self.user)
     self.add_url = reverse('leads:add',
                            kwargs={'event': self.event.pk})
     self.list_url = reverse('leads:leads',
                             kwargs={'event': self.event.pk})
     self.basic_lead_data = {
                 'name': 'new_lead',
                 'source': 'some_source',
                 'event': self.event.pk,
                 'confidentiality': 'UNP',
                 'assigned-to': self.user.pk,
                 'publish-date': '2017-03-17',
             }
Ejemplo n.º 6
0
 def setUp(self):
     self.user = login_user(self, admin=True)
Ejemplo n.º 7
0
 def setUp(self):
     self.user = login_user(self)