Commit 3d1583e0 by Bach Dániel

dashboard: fix tests

parent dc8620ef
......@@ -562,3 +562,5 @@ ADMIN_ENABLED = False
BLACKLIST_PASSWORD = get_env_variable("BLACKLIST_PASSWORD", "")
BLACKLIST_HOOK_URL = get_env_variable("BLACKLIST_HOOK_URL", "")
REQUEST_HOOK_URL = get_env_variable("REQUEST_HOOK_URL", "")
SSHKEY_EMAIL_ADD_KEY = False
......@@ -44,1221 +44,6 @@
},
{
"pk": 1,
"model": "auth.permission",
"fields": {
"codename": "add_permission",
"name": "Can add permission",
"content_type": 1
}
},
{
"pk": 2,
"model": "auth.permission",
"fields": {
"codename": "change_permission",
"name": "Can change permission",
"content_type": 1
}
},
{
"pk": 3,
"model": "auth.permission",
"fields": {
"codename": "delete_permission",
"name": "Can delete permission",
"content_type": 1
}
},
{
"pk": 4,
"model": "auth.permission",
"fields": {
"codename": "add_group",
"name": "Can add group",
"content_type": 2
}
},
{
"pk": 5,
"model": "auth.permission",
"fields": {
"codename": "change_group",
"name": "Can change group",
"content_type": 2
}
},
{
"pk": 6,
"model": "auth.permission",
"fields": {
"codename": "delete_group",
"name": "Can delete group",
"content_type": 2
}
},
{
"pk": 7,
"model": "auth.permission",
"fields": {
"codename": "add_user",
"name": "Can add user",
"content_type": 3
}
},
{
"pk": 8,
"model": "auth.permission",
"fields": {
"codename": "change_user",
"name": "Can change user",
"content_type": 3
}
},
{
"pk": 9,
"model": "auth.permission",
"fields": {
"codename": "delete_user",
"name": "Can delete user",
"content_type": 3
}
},
{
"pk": 10,
"model": "auth.permission",
"fields": {
"codename": "add_contenttype",
"name": "Can add content type",
"content_type": 4
}
},
{
"pk": 11,
"model": "auth.permission",
"fields": {
"codename": "change_contenttype",
"name": "Can change content type",
"content_type": 4
}
},
{
"pk": 12,
"model": "auth.permission",
"fields": {
"codename": "delete_contenttype",
"name": "Can delete content type",
"content_type": 4
}
},
{
"pk": 13,
"model": "auth.permission",
"fields": {
"codename": "add_session",
"name": "Can add session",
"content_type": 5
}
},
{
"pk": 14,
"model": "auth.permission",
"fields": {
"codename": "change_session",
"name": "Can change session",
"content_type": 5
}
},
{
"pk": 15,
"model": "auth.permission",
"fields": {
"codename": "delete_session",
"name": "Can delete session",
"content_type": 5
}
},
{
"pk": 16,
"model": "auth.permission",
"fields": {
"codename": "add_site",
"name": "Can add site",
"content_type": 6
}
},
{
"pk": 17,
"model": "auth.permission",
"fields": {
"codename": "change_site",
"name": "Can change site",
"content_type": 6
}
},
{
"pk": 18,
"model": "auth.permission",
"fields": {
"codename": "delete_site",
"name": "Can delete site",
"content_type": 6
}
},
{
"pk": 19,
"model": "auth.permission",
"fields": {
"codename": "add_logentry",
"name": "Can add log entry",
"content_type": 7
}
},
{
"pk": 20,
"model": "auth.permission",
"fields": {
"codename": "change_logentry",
"name": "Can change log entry",
"content_type": 7
}
},
{
"pk": 21,
"model": "auth.permission",
"fields": {
"codename": "delete_logentry",
"name": "Can delete log entry",
"content_type": 7
}
},
{
"pk": 22,
"model": "auth.permission",
"fields": {
"codename": "add_migrationhistory",
"name": "Can add migration history",
"content_type": 8
}
},
{
"pk": 23,
"model": "auth.permission",
"fields": {
"codename": "change_migrationhistory",
"name": "Can change migration history",
"content_type": 8
}
},
{
"pk": 24,
"model": "auth.permission",
"fields": {
"codename": "delete_migrationhistory",
"name": "Can delete migration history",
"content_type": 8
}
},
{
"pk": 25,
"model": "auth.permission",
"fields": {
"codename": "add_namedbaseresourceconfig",
"name": "Can add named base resource config",
"content_type": 9
}
},
{
"pk": 26,
"model": "auth.permission",
"fields": {
"codename": "change_namedbaseresourceconfig",
"name": "Can change named base resource config",
"content_type": 9
}
},
{
"pk": 27,
"model": "auth.permission",
"fields": {
"codename": "delete_namedbaseresourceconfig",
"name": "Can delete named base resource config",
"content_type": 9
}
},
{
"pk": 28,
"model": "auth.permission",
"fields": {
"codename": "add_node",
"name": "Can add node",
"content_type": 10
}
},
{
"pk": 29,
"model": "auth.permission",
"fields": {
"codename": "change_node",
"name": "Can change node",
"content_type": 10
}
},
{
"pk": 30,
"model": "auth.permission",
"fields": {
"codename": "delete_node",
"name": "Can delete node",
"content_type": 10
}
},
{
"pk": 31,
"model": "auth.permission",
"fields": {
"codename": "add_nodeactivity",
"name": "Can add node activity",
"content_type": 11
}
},
{
"pk": 32,
"model": "auth.permission",
"fields": {
"codename": "change_nodeactivity",
"name": "Can change node activity",
"content_type": 11
}
},
{
"pk": 33,
"model": "auth.permission",
"fields": {
"codename": "delete_nodeactivity",
"name": "Can delete node activity",
"content_type": 11
}
},
{
"pk": 34,
"model": "auth.permission",
"fields": {
"codename": "add_lease",
"name": "Can add lease",
"content_type": 12
}
},
{
"pk": 35,
"model": "auth.permission",
"fields": {
"codename": "change_lease",
"name": "Can change lease",
"content_type": 12
}
},
{
"pk": 36,
"model": "auth.permission",
"fields": {
"codename": "delete_lease",
"name": "Can delete lease",
"content_type": 12
}
},
{
"pk": 37,
"model": "auth.permission",
"fields": {
"codename": "add_instancetemplate",
"name": "Can add template",
"content_type": 13
}
},
{
"pk": 38,
"model": "auth.permission",
"fields": {
"codename": "change_instancetemplate",
"name": "Can change template",
"content_type": 13
}
},
{
"pk": 39,
"model": "auth.permission",
"fields": {
"codename": "delete_instancetemplate",
"name": "Can delete template",
"content_type": 13
}
},
{
"pk": 40,
"model": "auth.permission",
"fields": {
"codename": "add_interfacetemplate",
"name": "Can add interface template",
"content_type": 14
}
},
{
"pk": 41,
"model": "auth.permission",
"fields": {
"codename": "change_interfacetemplate",
"name": "Can change interface template",
"content_type": 14
}
},
{
"pk": 42,
"model": "auth.permission",
"fields": {
"codename": "delete_interfacetemplate",
"name": "Can delete interface template",
"content_type": 14
}
},
{
"pk": 43,
"model": "auth.permission",
"fields": {
"codename": "add_instance",
"name": "Can add instance",
"content_type": 15
}
},
{
"pk": 44,
"model": "auth.permission",
"fields": {
"codename": "change_instance",
"name": "Can change instance",
"content_type": 15
}
},
{
"pk": 45,
"model": "auth.permission",
"fields": {
"codename": "delete_instance",
"name": "Can delete instance",
"content_type": 15
}
},
{
"pk": 46,
"model": "auth.permission",
"fields": {
"codename": "add_instanceactivity",
"name": "Can add instance activity",
"content_type": 16
}
},
{
"pk": 47,
"model": "auth.permission",
"fields": {
"codename": "change_instanceactivity",
"name": "Can change instance activity",
"content_type": 16
}
},
{
"pk": 48,
"model": "auth.permission",
"fields": {
"codename": "delete_instanceactivity",
"name": "Can delete instance activity",
"content_type": 16
}
},
{
"pk": 49,
"model": "auth.permission",
"fields": {
"codename": "add_interface",
"name": "Can add interface",
"content_type": 17
}
},
{
"pk": 50,
"model": "auth.permission",
"fields": {
"codename": "change_interface",
"name": "Can change interface",
"content_type": 17
}
},
{
"pk": 51,
"model": "auth.permission",
"fields": {
"codename": "delete_interface",
"name": "Can delete interface",
"content_type": 17
}
},
{
"pk": 52,
"model": "auth.permission",
"fields": {
"codename": "add_datastore",
"name": "Can add datastore",
"content_type": 18
}
},
{
"pk": 53,
"model": "auth.permission",
"fields": {
"codename": "change_datastore",
"name": "Can change datastore",
"content_type": 18
}
},
{
"pk": 54,
"model": "auth.permission",
"fields": {
"codename": "delete_datastore",
"name": "Can delete datastore",
"content_type": 18
}
},
{
"pk": 55,
"model": "auth.permission",
"fields": {
"codename": "add_disk",
"name": "Can add disk",
"content_type": 19
}
},
{
"pk": 56,
"model": "auth.permission",
"fields": {
"codename": "change_disk",
"name": "Can change disk",
"content_type": 19
}
},
{
"pk": 57,
"model": "auth.permission",
"fields": {
"codename": "delete_disk",
"name": "Can delete disk",
"content_type": 19
}
},
{
"pk": 58,
"model": "auth.permission",
"fields": {
"codename": "add_rule",
"name": "Can add rule",
"content_type": 20
}
},
{
"pk": 59,
"model": "auth.permission",
"fields": {
"codename": "change_rule",
"name": "Can change rule",
"content_type": 20
}
},
{
"pk": 60,
"model": "auth.permission",
"fields": {
"codename": "delete_rule",
"name": "Can delete rule",
"content_type": 20
}
},
{
"pk": 61,
"model": "auth.permission",
"fields": {
"codename": "add_vlan",
"name": "Can add vlan",
"content_type": 21
}
},
{
"pk": 62,
"model": "auth.permission",
"fields": {
"codename": "change_vlan",
"name": "Can change vlan",
"content_type": 21
}
},
{
"pk": 63,
"model": "auth.permission",
"fields": {
"codename": "delete_vlan",
"name": "Can delete vlan",
"content_type": 21
}
},
{
"pk": 64,
"model": "auth.permission",
"fields": {
"codename": "add_vlangroup",
"name": "Can add vlan group",
"content_type": 22
}
},
{
"pk": 65,
"model": "auth.permission",
"fields": {
"codename": "change_vlangroup",
"name": "Can change vlan group",
"content_type": 22
}
},
{
"pk": 66,
"model": "auth.permission",
"fields": {
"codename": "delete_vlangroup",
"name": "Can delete vlan group",
"content_type": 22
}
},
{
"pk": 67,
"model": "auth.permission",
"fields": {
"codename": "add_group",
"name": "Can add group",
"content_type": 23
}
},
{
"pk": 68,
"model": "auth.permission",
"fields": {
"codename": "change_group",
"name": "Can change group",
"content_type": 23
}
},
{
"pk": 69,
"model": "auth.permission",
"fields": {
"codename": "delete_group",
"name": "Can delete group",
"content_type": 23
}
},
{
"pk": 70,
"model": "auth.permission",
"fields": {
"codename": "add_host",
"name": "Can add host",
"content_type": 24
}
},
{
"pk": 71,
"model": "auth.permission",
"fields": {
"codename": "change_host",
"name": "Can change host",
"content_type": 24
}
},
{
"pk": 72,
"model": "auth.permission",
"fields": {
"codename": "delete_host",
"name": "Can delete host",
"content_type": 24
}
},
{
"pk": 73,
"model": "auth.permission",
"fields": {
"codename": "add_firewall",
"name": "Can add firewall",
"content_type": 25
}
},
{
"pk": 74,
"model": "auth.permission",
"fields": {
"codename": "change_firewall",
"name": "Can change firewall",
"content_type": 25
}
},
{
"pk": 75,
"model": "auth.permission",
"fields": {
"codename": "delete_firewall",
"name": "Can delete firewall",
"content_type": 25
}
},
{
"pk": 76,
"model": "auth.permission",
"fields": {
"codename": "add_domain",
"name": "Can add domain",
"content_type": 26
}
},
{
"pk": 77,
"model": "auth.permission",
"fields": {
"codename": "change_domain",
"name": "Can change domain",
"content_type": 26
}
},
{
"pk": 78,
"model": "auth.permission",
"fields": {
"codename": "delete_domain",
"name": "Can delete domain",
"content_type": 26
}
},
{
"pk": 79,
"model": "auth.permission",
"fields": {
"codename": "add_record",
"name": "Can add record",
"content_type": 27
}
},
{
"pk": 80,
"model": "auth.permission",
"fields": {
"codename": "change_record",
"name": "Can change record",
"content_type": 27
}
},
{
"pk": 81,
"model": "auth.permission",
"fields": {
"codename": "delete_record",
"name": "Can delete record",
"content_type": 27
}
},
{
"pk": 82,
"model": "auth.permission",
"fields": {
"codename": "add_blacklist",
"name": "Can add blacklist",
"content_type": 28
}
},
{
"pk": 83,
"model": "auth.permission",
"fields": {
"codename": "change_blacklist",
"name": "Can change blacklist",
"content_type": 28
}
},
{
"pk": 84,
"model": "auth.permission",
"fields": {
"codename": "delete_blacklist",
"name": "Can delete blacklist",
"content_type": 28
}
},
{
"pk": 85,
"model": "auth.permission",
"fields": {
"codename": "add_taskmeta",
"name": "Can add task state",
"content_type": 29
}
},
{
"pk": 86,
"model": "auth.permission",
"fields": {
"codename": "change_taskmeta",
"name": "Can change task state",
"content_type": 29
}
},
{
"pk": 87,
"model": "auth.permission",
"fields": {
"codename": "delete_taskmeta",
"name": "Can delete task state",
"content_type": 29
}
},
{
"pk": 88,
"model": "auth.permission",
"fields": {
"codename": "add_tasksetmeta",
"name": "Can add saved group result",
"content_type": 30
}
},
{
"pk": 89,
"model": "auth.permission",
"fields": {
"codename": "change_tasksetmeta",
"name": "Can change saved group result",
"content_type": 30
}
},
{
"pk": 90,
"model": "auth.permission",
"fields": {
"codename": "delete_tasksetmeta",
"name": "Can delete saved group result",
"content_type": 30
}
},
{
"pk": 91,
"model": "auth.permission",
"fields": {
"codename": "add_intervalschedule",
"name": "Can add interval",
"content_type": 31
}
},
{
"pk": 92,
"model": "auth.permission",
"fields": {
"codename": "change_intervalschedule",
"name": "Can change interval",
"content_type": 31
}
},
{
"pk": 93,
"model": "auth.permission",
"fields": {
"codename": "delete_intervalschedule",
"name": "Can delete interval",
"content_type": 31
}
},
{
"pk": 94,
"model": "auth.permission",
"fields": {
"codename": "add_crontabschedule",
"name": "Can add crontab",
"content_type": 32
}
},
{
"pk": 95,
"model": "auth.permission",
"fields": {
"codename": "change_crontabschedule",
"name": "Can change crontab",
"content_type": 32
}
},
{
"pk": 96,
"model": "auth.permission",
"fields": {
"codename": "delete_crontabschedule",
"name": "Can delete crontab",
"content_type": 32
}
},
{
"pk": 97,
"model": "auth.permission",
"fields": {
"codename": "add_periodictasks",
"name": "Can add periodic tasks",
"content_type": 33
}
},
{
"pk": 98,
"model": "auth.permission",
"fields": {
"codename": "change_periodictasks",
"name": "Can change periodic tasks",
"content_type": 33
}
},
{
"pk": 99,
"model": "auth.permission",
"fields": {
"codename": "delete_periodictasks",
"name": "Can delete periodic tasks",
"content_type": 33
}
},
{
"pk": 100,
"model": "auth.permission",
"fields": {
"codename": "add_periodictask",
"name": "Can add periodic task",
"content_type": 34
}
},
{
"pk": 101,
"model": "auth.permission",
"fields": {
"codename": "change_periodictask",
"name": "Can change periodic task",
"content_type": 34
}
},
{
"pk": 102,
"model": "auth.permission",
"fields": {
"codename": "delete_periodictask",
"name": "Can delete periodic task",
"content_type": 34
}
},
{
"pk": 103,
"model": "auth.permission",
"fields": {
"codename": "add_workerstate",
"name": "Can add worker",
"content_type": 35
}
},
{
"pk": 104,
"model": "auth.permission",
"fields": {
"codename": "change_workerstate",
"name": "Can change worker",
"content_type": 35
}
},
{
"pk": 105,
"model": "auth.permission",
"fields": {
"codename": "delete_workerstate",
"name": "Can delete worker",
"content_type": 35
}
},
{
"pk": 106,
"model": "auth.permission",
"fields": {
"codename": "add_taskstate",
"name": "Can add task",
"content_type": 36
}
},
{
"pk": 107,
"model": "auth.permission",
"fields": {
"codename": "change_taskstate",
"name": "Can change task",
"content_type": 36
}
},
{
"pk": 108,
"model": "auth.permission",
"fields": {
"codename": "delete_taskstate",
"name": "Can delete task",
"content_type": 36
}
},
{
"pk": 109,
"model": "auth.permission",
"fields": {
"codename": "add_userobjectpermission",
"name": "Can add user object permission",
"content_type": 37
}
},
{
"pk": 110,
"model": "auth.permission",
"fields": {
"codename": "change_userobjectpermission",
"name": "Can change user object permission",
"content_type": 37
}
},
{
"pk": 111,
"model": "auth.permission",
"fields": {
"codename": "delete_userobjectpermission",
"name": "Can delete user object permission",
"content_type": 37
}
},
{
"pk": 112,
"model": "auth.permission",
"fields": {
"codename": "add_groupobjectpermission",
"name": "Can add group object permission",
"content_type": 38
}
},
{
"pk": 113,
"model": "auth.permission",
"fields": {
"codename": "change_groupobjectpermission",
"name": "Can change group object permission",
"content_type": 38
}
},
{
"pk": 114,
"model": "auth.permission",
"fields": {
"codename": "delete_groupobjectpermission",
"name": "Can delete group object permission",
"content_type": 38
}
},
{
"pk": 115,
"model": "auth.permission",
"fields": {
"codename": "own_instance",
"name": "owner",
"content_type": 15
}
},
{
"pk": 116,
"model": "auth.permission",
"fields": {
"codename": "operate_instance",
"name": "operator",
"content_type": 15
}
},
{
"pk": 117,
"model": "auth.permission",
"fields": {
"codename": "use_instance",
"name": "user",
"content_type": 15
}
},
{
"pk": 118,
"model": "auth.permission",
"fields": {
"codename": "add_diskactivity",
"name": "Can add disk activity",
"content_type": 39
}
},
{
"pk": 119,
"model": "auth.permission",
"fields": {
"codename": "change_diskactivity",
"name": "Can change disk activity",
"content_type": 39
}
},
{
"pk": 120,
"model": "auth.permission",
"fields": {
"codename": "delete_diskactivity",
"name": "Can delete disk activity",
"content_type": 39
}
},
{
"pk": 121,
"model": "auth.permission",
"fields": {
"codename": "add_level",
"name": "Can add level",
"content_type": 40
}
},
{
"pk": 122,
"model": "auth.permission",
"fields": {
"codename": "change_level",
"name": "Can change level",
"content_type": 40
}
},
{
"pk": 123,
"model": "auth.permission",
"fields": {
"codename": "delete_level",
"name": "Can delete level",
"content_type": 40
}
},
{
"pk": 127,
"model": "auth.permission",
"fields": {
"codename": "add_objectlevel",
"name": "Can add object level",
"content_type": 42
}
},
{
"pk": 128,
"model": "auth.permission",
"fields": {
"codename": "change_objectlevel",
"name": "Can change object level",
"content_type": 42
}
},
{
"pk": 129,
"model": "auth.permission",
"fields": {
"codename": "delete_objectlevel",
"name": "Can delete object level",
"content_type": 42
}
},
{
"pk": 130,
"model": "auth.permission",
"fields": {
"codename": "add_switchport",
"name": "Can add switch port",
"content_type": 43
}
},
{
"pk": 131,
"model": "auth.permission",
"fields": {
"codename": "change_switchport",
"name": "Can change switch port",
"content_type": 43
}
},
{
"pk": 132,
"model": "auth.permission",
"fields": {
"codename": "delete_switchport",
"name": "Can delete switch port",
"content_type": 43
}
},
{
"pk": 133,
"model": "auth.permission",
"fields": {
"codename": "add_ethernetdevice",
"name": "Can add ethernet device",
"content_type": 44
}
},
{
"pk": 134,
"model": "auth.permission",
"fields": {
"codename": "change_ethernetdevice",
"name": "Can change ethernet device",
"content_type": 44
}
},
{
"pk": 135,
"model": "auth.permission",
"fields": {
"codename": "delete_ethernetdevice",
"name": "Can delete ethernet device",
"content_type": 44
}
},
{
"pk": 1366,
"model": "auth.permission",
"fields": {
"codename": "config_ports",
"name": "Can configure port forwards.",
"content_type": 28
}
},
{
"pk": 1367,
"model": "auth.permission",
"fields": {
"codename": "create_vm",
"name": "Can create a new VM.",
"content_type": 28
}
},
{
"pk": 1368,
"model": "auth.permission",
"fields": {
"codename": "access_console",
"name": "Can access the graphical console of a VM.",
"content_type": 28
}
},
{
"pk": 1,
"model": "auth.group",
"fields": {
"name": "csopi",
......
......@@ -1706,7 +1706,11 @@ class SshKeyTest(LoginMixin, TestCase):
self.u2.set_password('password')
self.u2.profile = Profile()
self.u2.save()
self.k1 = UserKey(key='ssh-rsa AAAAB3NzaC1yc2EC asd', user=self.u1)
self.valid_key = (
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAYQDGqQy86fpVL3fAPE9ExTSvg4"
"Me7bpzH4azerTwWl8u9KKbhYe8XnC+cpvzbRxinFE9SqgQtKJzuxE0f/hHsNCQ"
"t3zDLHsqfFUdFQzkImXJ+duUKGyHKIsx6Os0j6nl+3c= asd")
self.k1 = UserKey(key=self.valid_key, user=self.u1)
self.k1.save()
def tearDown(self):
......@@ -1719,7 +1723,7 @@ class SshKeyTest(LoginMixin, TestCase):
self.login(c, self.u1)
resp = c.post("/dashboard/sshkey/1/",
{'key': 'ssh-rsa AAAAB3NzaC1yc2EC'})
{'key': self.valid_key})
self.assertEqual(UserKey.objects.get(id=1).user, self.u1)
self.assertEqual(200, resp.status_code)
......@@ -1728,7 +1732,7 @@ class SshKeyTest(LoginMixin, TestCase):
self.login(c, self.u2)
resp = c.post("/dashboard/sshkey/1/",
{'key': 'ssh-rsa AAAAB3NzaC1yc2EC'})
{'key': self.valid_key})
self.assertEqual(UserKey.objects.get(id=1).user, self.u1)
self.assertEqual(403, resp.status_code)
......@@ -1737,7 +1741,7 @@ class SshKeyTest(LoginMixin, TestCase):
self.login(c, self.u1)
resp = c.post("/dashboard/sshkey/create/",
{'name': 'asd', 'key': 'ssh-rsa AAAAB3NzaC1yc2EC'})
{'name': 'asd', 'key': self.valid_key})
self.assertEqual(UserKey.objects.get(id=2).user, self.u1)
self.assertEqual(302, resp.status_code)
......
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