Skip to content

Commit

Permalink
Remove unnecessary django Client
Browse files Browse the repository at this point in the history
Django TestCase already sets self.client to a Client instance.
  • Loading branch information
153957 committed Jul 11, 2022
1 parent 523b0fe commit a21b913
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 13 deletions.
3 changes: 1 addition & 2 deletions tests/test_api/test_views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from datetime import date, timedelta

from django.test import Client, TestCase
from django.test import TestCase
from django.urls import reverse

from ..factories.histograms_factories import ConfigurationFactory
Expand All @@ -13,7 +13,6 @@ class TestViews(TestCase):
"""Test if all endpoints work and sometimes that the expected data is returned"""

def setUp(self):
self.client = Client()
self.station = StationFactory(number=1, cluster__number=0, cluster__country__number=0)
self.config = ConfigurationFactory(summary__station=self.station)
self.pc = PcFactory(station=self.station, is_test=False)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_maps/test_views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.test import Client, TestCase
from django.test import TestCase
from django.urls import reverse

from ..factories import histograms_factories
Expand All @@ -7,7 +7,6 @@

class TestViews(TestCase):
def setUp(self):
self.client = Client()
self.station = StationFactory(number=1, cluster__number=0, cluster__country__number=0)
self.summary = histograms_factories.SummaryFactory(station=self.station)
self.config = histograms_factories.ConfigurationFactory(summary=self.summary)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_raw_data/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from os.path import abspath, dirname, join

from django.test import Client, TestCase, override_settings
from django.test import TestCase, override_settings
from django.urls import reverse

from ..factories import histograms_factories, inforecords_factories
Expand All @@ -12,7 +12,6 @@
class TestDownload(TestCase):

def setUp(self):
self.client = Client()
# Required models
cluster = inforecords_factories.ClusterFactory(name='Amsterdam', number=0, country__number=0)
self.station = inforecords_factories.StationFactory(name='Nikhef', number=501, cluster=cluster)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_station_layout/test_views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.core import mail
from django.test import Client, TestCase
from django.test import TestCase
from django.urls import reverse

from ..factories.inforecords_factories import StationFactory
Expand All @@ -8,7 +8,6 @@

class TestViews(TestCase):
def setUp(self):
self.client = Client()
self.station = StationFactory(number=1, cluster__number=0, cluster__country__number=0)
super().setUp()

Expand Down
4 changes: 1 addition & 3 deletions tests/test_status_display/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from numpy import genfromtxt

from django.test import Client, TestCase
from django.test import TestCase
from django.urls import reverse

from ..factories import histograms_factories
Expand All @@ -13,7 +13,6 @@

class TestViews(TestCase):
def setUp(self):
self.client = Client()
self.station = StationFactory(number=1, cluster__number=0, cluster__country__number=0)
self.summary = histograms_factories.SummaryFactory(station=self.station)
histograms_factories.EventtimeHistogramFactory(summary=self.summary)
Expand Down Expand Up @@ -76,7 +75,6 @@ def test_help(self):

class TestSourceViews(TestCase):
def setUp(self):
self.client = Client()
self.station = StationFactory(number=1, cluster__number=0, cluster__country__number=0)
self.summary = histograms_factories.SummaryFactory(station=self.station)
self.network_summary = histograms_factories.NetworkSummaryFactory(date=self.summary.date)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_updates/test_views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from tempfile import mkdtemp
from urllib.parse import parse_qs

from django.test import Client, TestCase, override_settings
from django.test import TestCase, override_settings
from django.urls import reverse

from ..factories.updates_factories import AdminUpdateFactory, InstallerUpdateFactory, UserUpdateFactory
Expand All @@ -10,7 +10,6 @@
@override_settings(MEDIA_ROOT=mkdtemp(prefix='mediaroot'))
class TestViews(TestCase):
def setUp(self):
self.client = Client()
self.admin_update = AdminUpdateFactory(queue__slug='hisparc')
self.user_update = UserUpdateFactory(queue__slug='hisparc')
self.installer_update = InstallerUpdateFactory(queue__slug='hisparc')
Expand Down

0 comments on commit a21b913

Please sign in to comment.