<commit_before># Django
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase

# This app
from astrobin_apps_notifications.utils import *
from astrobin_apps_notifications.templatetags.astrobin_apps_notifications_tags import *


class NotificationsTest(TestCase):
    def setUp(self):
        self.user1 = User.objects.create_user(
            username = "user1",
            email = "<EMAIL>",
            password = "password")
        self.user2 = User.objects.create_user(
            username = "user2",
            email = "<EMAIL>",
            password = "password")


    def tearDown(self):
        self.user1.delete()
        self.user2.delete()


    def test_test_notification_view(self):
        self.client.login(username = 'user1', password = 'password')
        response = self.client.post(
            reverse('astrobin_apps_notifications.test_notification',
                    args = ('user2',)), {})
        self.assertEquals(response.status_code, 200)
        self.assertEquals("test_notification sent" in response.content, True)
        self.assertEquals(get_recent_notifications(self.user2).count(), 1)
        self.assertEquals(get_seen_notifications(self.user2).count(), 0)
        self.assertEquals(get_unseen_notifications(self.user2).count(), 1)
        self.client.logout()


    def test_notification_list_tag(self):
        self.client.login(username = 'user1', password = 'password')
        response = self.client.post(
            reverse('astrobin_apps_notifications.test_notification',
                    args = ('user2',)), {})
        self.client.logout()
        self.client.login(username = 'user2', password = 'password')

        response = notification_list(self.user2)
        self.assertEquals(len(response['unseen']), 1)
        self.assertEquals(response['unseen'][0], get_unseen_notifications(self.user2)[0])
        self.assertEquals(len(response['seen']), 0)
        self.client.logout()<commit_msg>Fix astrobin_apps_notifications tests<commit_after># Django
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase

# This app
from astrobin_apps_notifications.utils import *
from astrobin_apps_notifications.templatetags.astrobin_apps_notifications_tags import *


class NotificationsTest(TestCase):
    def setUp(self):
        self.user1 = User.objects.create_user(
            username = "user1",
            email = "<EMAIL>",
            password = "password")
        self.user2 = User.objects.create_user(
            username = "user2",
            email = "<EMAIL>",
            password = "password")


    def tearDown(self):
        self.user1.delete()
        self.user2.delete()


    def test_test_notification_view(self):
        self.client.login(username = 'user1', password = 'password')
        response = self.client.post(
            reverse('astrobin_apps_notifications.test_notification',
                    args = ('user2',)), {})
        self.assertEquals(response.status_code, 200)
        self.assertEquals("test_notification sent" in response.content, True)
        self.assertEquals(get_recent_notifications(self.user2).count(), 1)
        self.assertEquals(get_seen_notifications(self.user2).count(), 0)
        self.assertEquals(get_unseen_notifications(self.user2).count(), 1)
        self.client.logout()


    def test_notification_list_tag(self):
        self.client.login(username = 'user1', password = 'password')
        response = self.client.post(
            reverse('astrobin_apps_notifications.test_notification',
                    args = ('user2',)), {})
        self.client.logout()
        self.client.login(username = 'user2', password = 'password')

        response = notification_list(self.user2, -1, -1)
        self.assertEquals(len(response['unseen']), 1)
        self.assertEquals(response['unseen'][0], get_unseen_notifications(self.user2)[0])
        self.assertEquals(len(response['seen']), 0)
        self.client.logout()
{'fraction_non_alphanumeric': 0.12045231071779744, 'fraction_numerical': 0.01327433628318584, 'mean_word_length': 3.0088669950738915, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4134816', 'n_tokens_mistral': 1176, 'n_tokens_neox': 1141, 'n_words': 195}