Commit ec8a25ba by Dudás Ádám

Merge branch 'issue-457' into 'master'

Terminal icon



See merge request !382
parents 3cff165b 870fde3d
Pipeline #154 passed with stage
in 0 seconds
...@@ -52,7 +52,8 @@ class ViewUserTestCase(unittest.TestCase): ...@@ -52,7 +52,8 @@ class ViewUserTestCase(unittest.TestCase):
def test_not_superuser(self): def test_not_superuser(self):
request = FakeRequestFactory(superuser=False) request = FakeRequestFactory(superuser=False)
with patch.object(InstanceActivityDetail, 'get_object') as go: with patch.object(InstanceActivityDetail, 'get_object') as go:
go.return_value = MagicMock(spec=InstanceActivity) go.return_value = MagicMock(spec=InstanceActivity,
activity_code='test.test')
go.return_value._meta.object_name = "InstanceActivity" go.return_value._meta.object_name = "InstanceActivity"
view = InstanceActivityDetail.as_view() view = InstanceActivityDetail.as_view()
self.assertEquals(view(request, pk=1234).status_code, 200) self.assertEquals(view(request, pk=1234).status_code, 200)
...@@ -61,7 +62,8 @@ class ViewUserTestCase(unittest.TestCase): ...@@ -61,7 +62,8 @@ class ViewUserTestCase(unittest.TestCase):
request = FakeRequestFactory(superuser=True) request = FakeRequestFactory(superuser=True)
with patch.object(InstanceActivityDetail, 'get_object') as go: with patch.object(InstanceActivityDetail, 'get_object') as go:
act = MagicMock(spec=InstanceActivity) act = MagicMock(spec=InstanceActivity,
activity_code='test.test')
act._meta.object_name = "InstanceActivity" act._meta.object_name = "InstanceActivity"
act.user.pk = 1 act.user.pk = 1
go.return_value = act go.return_value = act
......
...@@ -46,6 +46,7 @@ from braces.views import SuperuserRequiredMixin, LoginRequiredMixin ...@@ -46,6 +46,7 @@ from braces.views import SuperuserRequiredMixin, LoginRequiredMixin
from common.models import ( from common.models import (
create_readable, HumanReadableException, fetch_human_exception, create_readable, HumanReadableException, fetch_human_exception,
split_activity_code,
) )
from firewall.models import Vlan, Host, Rule from firewall.models import Vlan, Host, Rule
from manager.scheduler import SchedulerError from manager.scheduler import SchedulerError
...@@ -798,6 +799,8 @@ def _get_activity_icon(act): ...@@ -798,6 +799,8 @@ def _get_activity_icon(act):
op = act.get_operation() op = act.get_operation()
if op and op.id in vm_ops: if op and op.id in vm_ops:
return vm_ops[op.id].icon return vm_ops[op.id].icon
elif split_activity_code(act.activity_code)[-1] == u'console-accessed':
return "terminal"
else: else:
return "cog" return "cog"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment