def setUp(self):
        self.user = UserFactory()
        self.basic_user = UserFactory.build(first_name='')

        self.period = FlowEventFactory()
        FlowEventFactory(user=self.period.user,
                         timestamp=TIMEZONE.localize(datetime.datetime(2014, 2, 27)))
        FlowEventFactory(user=self.period.user,
                         timestamp=TIMEZONE.localize(datetime.datetime(2014, 3, 24)))
Пример #2
0
    def setUp(self):
        self.user = UserFactory()
        self.basic_user = UserFactory.build(first_name='')

        self.period = FlowEventFactory()
        FlowEventFactory(user=self.period.user,
                         timestamp=TIMEZONE.localize(
                             datetime.datetime(2014, 2, 27)))
        FlowEventFactory(user=self.period.user,
                         timestamp=TIMEZONE.localize(
                             datetime.datetime(2014, 3, 24)))
Пример #3
0
class TestUser(TestCase):
    def setUp(self):
        self.user = UserFactory()
        self.basic_user = UserFactory.build(first_name='')

        self.period = FlowEventFactory()
        FlowEventFactory(user=self.period.user,
                         timestamp=TIMEZONE.localize(
                             datetime.datetime(2014, 2, 27)))
        FlowEventFactory(user=self.period.user,
                         timestamp=TIMEZONE.localize(
                             datetime.datetime(2014, 3, 24)))

    def test_get_cycle_lengths_no_data(self):
        self.assertEqual([], self.basic_user.get_cycle_lengths())

    def test_get_cycle_lengths(self):
        self.assertEqual([27, 25], self.period.user.get_cycle_lengths())

    def test_get_sorted_cycle_lengths_no_data(self):
        self.assertEqual([], self.basic_user.get_sorted_cycle_lengths())

    def test_get_sorted_cycle_lengths(self):
        self.assertEqual([25, 27], self.period.user.get_sorted_cycle_lengths())

    def test_get_full_name_email(self):
        self.assertTrue(
            re.match(r'user_[\d][email protected]',
                     '%s' % self.basic_user.get_full_name()))

    def test_get_full_name(self):
        self.assertEqual(u'Jessamyn', '%s' % self.user.get_full_name())

    def test_get_short_name_email(self):
        self.assertTrue(
            re.match(r'user_[\d][email protected]',
                     '%s' % self.basic_user.get_short_name()))

    def test_get_short_name(self):
        self.assertEqual(u'Jessamyn', '%s' % self.user.get_short_name())

    def test_str(self):
        self.assertTrue(
            re.match(r'user_[\d][email protected] \(user_[\d][email protected]\)',
                     '%s' % self.basic_user))
Пример #4
0
    def test_api_authenticate_success(self, mock_authenticate):
        user = UserFactory()
        mock_authenticate.return_value = user

        response = self.client.post(self.url_path,
                                    data=json.dumps(self.data),
                                    content_type='application/json')

        self.assertContains(response, user.auth_token.key)
class TestUser(TestCase):

    def setUp(self):
        self.user = UserFactory()
        self.basic_user = UserFactory.build(first_name='')

        self.period = FlowEventFactory()
        FlowEventFactory(user=self.period.user,
                         timestamp=TIMEZONE.localize(datetime.datetime(2014, 2, 27)))
        FlowEventFactory(user=self.period.user,
                         timestamp=TIMEZONE.localize(datetime.datetime(2014, 3, 24)))

    def test_get_cycle_lengths_no_data(self):
        self.assertEqual([], self.basic_user.get_cycle_lengths())

    def test_get_cycle_lengths(self):
        self.assertEqual([27, 25], self.period.user.get_cycle_lengths())

    def test_get_sorted_cycle_lengths_no_data(self):
        self.assertEqual([], self.basic_user.get_sorted_cycle_lengths())

    def test_get_sorted_cycle_lengths(self):
        self.assertEqual([25, 27], self.period.user.get_sorted_cycle_lengths())

    def test_get_full_name_email(self):
        self.assertTrue(re.match(r'user_[\d][email protected]', '%s' % self.basic_user.get_full_name()))

    def test_get_full_name(self):
        self.assertEqual(u'Jessamyn', '%s' % self.user.get_full_name())

    def test_get_short_name_email(self):
        self.assertTrue(re.match(r'user_[\d][email protected]',
                                 '%s' % self.basic_user.get_short_name()))

    def test_get_short_name(self):
        self.assertEqual(u'Jessamyn', '%s' % self.user.get_short_name())

    def test_str(self):
        self.assertTrue(re.match(r'user_[\d][email protected] \(user_[\d][email protected]\)',
                                 '%s' % self.basic_user))
Пример #6
0
 def setUp(self):
     self.user = UserFactory()
     self.period = FlowEventFactory()
Пример #7
0
 def setUp(self):
     self.user = UserFactory()
     self.client = Client()
     self.client.login(email=self.user.email, password=PASSWORD)
Пример #8
0
    def setUp(self):
        self.mixin = views.FlowEventMixin()

        self.request = HttpRequest()
        self.request.user = UserFactory()
        self.mixin.request = self.request