Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused variables #1010

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/argus/dev/management/commands/create_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ def handle(self, *args, **options):
source_type = options.get("source_type") or "argus"
sst = SourceSystemTypeFactory(name=source_type)
user = SourceUserFactory(username=source)
ss = SourceSystemFactory(name=source, type=sst, user=user)
SourceSystemFactory(name=source, type=sst, user=user)
2 changes: 1 addition & 1 deletion src/argus/notificationprofile/media/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def send_email_safely(function, additional_error=None, *args, **kwargs) -> int:
try:
result = function(*args, **kwargs)
return result
except ConnectionRefusedError as e:
except ConnectionRefusedError:
EMAIL_HOST = getattr(settings, "EMAIL_HOST", None)
if not EMAIL_HOST:
LOG.error("Notification: Email: EMAIL_HOST not set, cannot send")
Expand Down
4 changes: 2 additions & 2 deletions tests/auth/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_is_end_user(self):

def test_is_source_system(self):
user = SourceUserFactory()
ss = SourceSystemFactory(user=user)
SourceSystemFactory(user=user)
self.assertTrue(user.is_source_system)


Expand Down Expand Up @@ -56,7 +56,7 @@ def test_is_not_dormant_if_source_of_incident(self):
user = SourceUserFactory()
source = SourceSystemFactory(user=user)

incident = StatelessIncidentFactory(source=source)
StatelessIncidentFactory(source=source)
self.assertTrue(user.is_used())

def test_is_not_dormant_if_actor_of_event(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/incident/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def test_ticket_false(self):
def test_tags_single(self):
user = SourceUserFactory()
tag1 = TagFactory(key="testkey1", value="testvalue1")
tag2 = TagFactory(key="testkey2", value="testvalue2")
TagFactory(key="testkey2", value="testvalue2")
incident5 = StatefulIncidentFactory(source=self.source1)
for incident in (self.incident1, self.incident2, self.incident3):
IncidentTagRelation.objects.get_or_create(tag=tag1, incident=incident, added_by=user)
Expand Down
16 changes: 8 additions & 8 deletions tests/incident/test_incident_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,31 +113,31 @@ class KeyValueFieldTest(TestCase):
def test_key_value_must_not_be_empty(self):
f = KeyValueField()
with self.assertRaises(ValidationError):
result = f.clean("")
f.clean("")

def test_key_value_must_not_be_just_equals(self):
f = KeyValueField()
with self.assertRaises(ValidationError):
result = f.clean("=")
f.clean("=")

def test_key_value_must_contain_at_least_one_equals(self):
f = KeyValueField()
with self.assertRaises(ValidationError):
result = f.clean("boo")
f.clean("boo")

def test_value_cannot_be_empty(self):
f = KeyValueField()
with self.assertRaises(ValidationError):
result = f.clean("a=")
f.clean("a=")

def test_key_must_fit_regex(self):
# [a-z0-9_]+
f = KeyValueField()
with self.assertRaises(ValidationError):
result = f.clean("=v")
f.clean("=v")
with self.assertRaises(ValidationError):
result = f.clean(" =v")
f.clean(" =v")
with self.assertRaises(ValidationError):
result = f.clean("A=v")
f.clean("A=v")
with self.assertRaises(ValidationError):
result = f.clean("-=v")
f.clean("-=v")
2 changes: 1 addition & 1 deletion tests/incident/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def test_source_cannot_delete_unowned_incident_if_indelible_is_False(self):

source_type = SourceSystemTypeFactory()
user = SourceUserFactory()
source = SourceSystemFactory(type=source_type, user=user)
SourceSystemFactory(type=source_type, user=user)
self.client.force_authenticate(user=user)

response = self.client.delete(path=f"/api/v2/incidents/{incident_pk}/")
Expand Down
1 change: 0 additions & 1 deletion tests/notificationprofile/test_github236.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def tearDown(self):
connect_signals()

def test_sending_event_to_multiple_profiles_of_the_same_user_should_not_raise_exception(self):
LOG_PREFIX = "INFO:argus.notificationprofile.media:"
# Send a test event
self.incident = create_fake_incident()
event = self.incident.events.get(type=Event.Type.INCIDENT_START)
Expand Down
4 changes: 2 additions & 2 deletions tests/notificationprofile/test_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def test_cannot_create_timeslot_with_duplicate_name(self):
)
# serializer.create works on already validated data
with self.assertRaises(IntegrityError):
obj = serializer.create(validated_data)
serializer.create(validated_data)

def test_can_update_timeslot(self):
timeslot = TimeslotFactory(name="existing name", user=self.user)
Expand Down Expand Up @@ -127,4 +127,4 @@ def test_cannot_update_timeslot_with_duplicate_name(self):
)
# serializer.create works on already validated data
with self.assertRaises(IntegrityError):
obj = serializer.update(timeslot, validated_data)
serializer.update(timeslot, validated_data)
2 changes: 1 addition & 1 deletion tests/notificationprofile/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def setUp(self):
self.source2 = SourceSystemFactory(name="System 2", type=source_type2, user=source2_user)

self.incident1 = StatelessIncidentFactory(source=self.source1)
incident2 = StatelessIncidentFactory(source=self.source2)
StatelessIncidentFactory(source=self.source2)

timeslot1 = TimeslotFactory(user=user1, name="Never")
filter1 = FilterFactory(
Expand Down
Loading