mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-11 12:29:24 +00:00
use google convention for docstrings
This commit is contained in:
@ -46,9 +46,7 @@ class GalaxyTestModel(TestCase):
|
||||
cls.com = User.objects.get(username="comunity")
|
||||
|
||||
def test_user_self_score(self):
|
||||
"""
|
||||
Test that individual user scores are correct
|
||||
"""
|
||||
"""Test that individual user scores are correct."""
|
||||
with self.assertNumQueries(8):
|
||||
assert Galaxy.compute_user_score(self.root) == 9
|
||||
assert Galaxy.compute_user_score(self.skia) == 10
|
||||
@ -60,9 +58,8 @@ class GalaxyTestModel(TestCase):
|
||||
assert Galaxy.compute_user_score(self.com) == 1
|
||||
|
||||
def test_users_score(self):
|
||||
"""
|
||||
Test on the default dataset generated by the `populate` command
|
||||
that the relation scores are correct
|
||||
"""Test on the default dataset generated by the `populate` command
|
||||
that the relation scores are correct.
|
||||
"""
|
||||
expected_scores = {
|
||||
"krophil": {
|
||||
@ -138,8 +135,7 @@ class GalaxyTestModel(TestCase):
|
||||
self.assertDictEqual(expected_scores, computed_scores)
|
||||
|
||||
def test_rule(self):
|
||||
"""
|
||||
Test on the default dataset generated by the `populate` command
|
||||
"""Test on the default dataset generated by the `populate` command
|
||||
that the number of queries to rule the galaxy is stable.
|
||||
"""
|
||||
galaxy = Galaxy.objects.create()
|
||||
@ -151,18 +147,14 @@ class GalaxyTestModel(TestCase):
|
||||
class GalaxyTestView(TestCase):
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
"""
|
||||
Generate a plausible Galaxy once for every test
|
||||
"""
|
||||
"""Generate a plausible Galaxy once for every test."""
|
||||
call_command("generate_galaxy_test_data", "-v", "0")
|
||||
galaxy = Galaxy.objects.create()
|
||||
galaxy.rule(26) # We want a fast test
|
||||
cls.root = User.objects.get(username="root")
|
||||
|
||||
def test_page_is_citizen(self):
|
||||
"""
|
||||
Test that users can access the galaxy page of users who are citizens
|
||||
"""
|
||||
"""Test that users can access the galaxy page of users who are citizens."""
|
||||
self.client.force_login(self.root)
|
||||
user = User.objects.get(last_name="n°500")
|
||||
response = self.client.get(reverse("galaxy:user", args=[user.id]))
|
||||
@ -173,20 +165,19 @@ class GalaxyTestView(TestCase):
|
||||
)
|
||||
|
||||
def test_page_not_citizen(self):
|
||||
"""
|
||||
Test that trying to access the galaxy page of a user who is not
|
||||
citizens return a 404
|
||||
"""
|
||||
"""Test that trying to access the galaxy page of non-citizen users return a 404."""
|
||||
self.client.force_login(self.root)
|
||||
user = User.objects.get(last_name="n°1")
|
||||
response = self.client.get(reverse("galaxy:user", args=[user.id]))
|
||||
assert response.status_code == 404
|
||||
|
||||
def test_full_galaxy_state(self):
|
||||
"""
|
||||
Test on the more complex dataset generated by the `generate_galaxy_test_data`
|
||||
command that the relation scores are correct, and that the view exposes the
|
||||
right data.
|
||||
"""Test with a more complete galaxy.
|
||||
|
||||
This time, the test is done on
|
||||
the more complex dataset generated by the `generate_galaxy_test_data`
|
||||
command that the relation scores are correct,
|
||||
and that the view exposes the right data.
|
||||
"""
|
||||
self.client.force_login(self.root)
|
||||
response = self.client.get(reverse("galaxy:data"))
|
||||
|
Reference in New Issue
Block a user