<commit_before>"""Game application tests"""

import datetime
#from django.utils import timezone
from django.test import TestCase
from django.urls import reverse
from django.test.client import Client
from django.contrib.auth.models import User
from game.models import Location, Profile, Announcement, Safezone
#from unittest import mock

class RegistrationTests(TestCase):
    pass

class IndexViewTests(TestCase):
    """Testing index view"""
    def test_index_view_exists(self):
        """Test view works"""
        response = self.client.get(reverse('game:index'))
        self.assertEqual(response.status_code, 200)

class LoginTestCase(TestCase):
    def test_login_view_exists(self):
        """Login view exists"""
        response = self.client.get('/login/')
        self.assertEqual(response.status_code, 200)

    def test_login_works(self):
        pass

class UserViewTests(TestCase):
    """Testing users view"""
    def test_users_view_exists(self):
        """Test view exists"""
        response = self.client.get(reverse('game:users'))
        self.assertEqual(response.status_code, 200)

class LeaderboardViewTests(TestCase):
    """Testing leaderboard view"""
    def test_leaderboard_view_exists(self):
        """Test view exists"""
        response = self.client.get(reverse('game:leaderboard'))
        self.assertEqual(response.status_code, 200)

class PlayViewTests(TestCase):
    """Testing play view"""
    def test_play_view_exists(self):
        """Test view exists"""
        response = self.client.get(reverse('game:play'))
        self.assertEqual(response.status_code, 200)

class LocationTestCase(TestCase):
    """Testing location model"""
    def test_total_methods(self):
        """
        Test total matches method,
        combines matches won and matches lost values
        """
        ccny = Location.objects.create(location_text="CCNY", matches_won=70, matches_lost=30)
        self.assertEqual(ccny.total_matches(), 100)

    def test_infection_rate(self):
        """
        Test infection rate method
        matches lost / total matches played<commit_msg>test logout view and __str__ method of Location model<commit_after>"""Game application tests"""

import datetime
#from django.utils import timezone
from django.test import TestCase
from django.urls import reverse
from django.test.client import Client
from django.contrib.auth.models import User
from game.models import Location, Profile, Announcement, Safezone
#from unittest import mock

class RegistrationTests(TestCase):
    pass

class IndexViewTests(TestCase):
    """Testing index view"""
    def test_index_view_exists(self):
        """Test view works"""
        response = self.client.get(reverse('game:index'))
        self.assertEqual(response.status_code, 200)

class LoginTestCase(TestCase):
    def test_login_view_exists(self):
        """Login view exists"""
        response = self.client.get('/login/')
        self.assertEqual(response.status_code, 200)

    def test_login_works(self):
        pass

class LogoutViewTests(TestCase):
    """Testing register view"""
    def test_register_view_exists(self):
        """Test view works"""
        response = self.client.get(reverse('game:logout_successful'))
        self.assertEqual(response.status_code, 200)

class UserViewTests(TestCase):
    """Testing users view"""
    def test_users_view_exists(self):
        """Test view exists"""
        response = self.client.get(reverse('game:users'))
        self.assertEqual(response.status_code, 200)

class LeaderboardViewTests(TestCase):
    """Testing leaderboard view"""
    def test_leaderboard_view_exists(self):
        """Test view exists"""
        response = self.client.get(reverse('game:leaderboard'))
        self.assertEqual(response.status_code, 200)

class PlayViewTests(TestCase):
    """Testing play view"""
    def test_play_view_exists(self):
        """Test view exists"""
        response = self.client.get(reverse('game:play'))
        self.assertEqual(response.status_code, 200)

class LocationTestCase(TestCase):
    """Testing location model"""
    def test_return_location(self):
        """
        Return Location name
        """
        ccny = Location.objects.create(location_text="CCNY", matches_won=70, matches_lost=30)
        test_text = str(ccny.__str__())
        self.assertEqual(test_text, "CCNY")

    def test_total_methods(self):
        """
        Test total matches method,
        combines matches won and matches lost values
        """
        ccny = Location.objects.create(location_text="CCNY", matches_won=70, matches_lost=30)
        self.assertEqual(ccny.total_matches(), 100)

    def test_infection_rate(self):
        """
        Test infection rate method
        matches lost / total matches played
{'fraction_non_alphanumeric': 0.11085546956703618, 'fraction_numerical': 0.010667224430035557, 'mean_word_length': 3.5760765550239233, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3260805', 'n_tokens_mistral': 1331, 'n_tokens_neox': 1272, 'n_words': 322}