@@ -14,104 +14,104 @@ import {
1414module ( 'Unit | Abilities | Account' , function ( hooks ) {
1515 setupTest ( hooks ) ;
1616
17- let canService ;
17+ let abilitiesService ;
1818 let store ;
1919
2020 hooks . beforeEach ( function ( ) {
21- canService = this . owner . lookup ( 'service:can ' ) ;
21+ abilitiesService = this . owner . lookup ( 'service:abilities ' ) ;
2222 store = this . owner . lookup ( 'service:store' ) ;
2323 } ) ;
2424
2525 test ( 'it reflects when a given account may set password based on authorized_actions' , function ( assert ) {
2626 const account = store . createRecord ( 'auth-method' , {
2727 authorized_actions : [ 'set-password' ] ,
2828 } ) ;
29- assert . true ( canService . can ( 'setPassword account' , account ) ) ;
29+ assert . true ( abilitiesService . can ( 'setPassword account' , account ) ) ;
3030 account . authorized_actions = [ ] ;
31- assert . false ( canService . can ( 'setPassword account' , account ) ) ;
31+ assert . false ( abilitiesService . can ( 'setPassword account' , account ) ) ;
3232 } ) ;
3333
3434 test ( 'can read known account types when authorized' , function ( assert ) {
3535 const account = store . createRecord ( 'account' , {
3636 authorized_actions : [ 'read' ] ,
3737 type : TYPE_AUTH_METHOD_OIDC ,
3838 } ) ;
39- assert . true ( canService . can ( 'read account' , account ) ) ;
39+ assert . true ( abilitiesService . can ( 'read account' , account ) ) ;
4040 account . type = TYPE_AUTH_METHOD_PASSWORD ;
41- assert . true ( canService . can ( 'read account' , account ) ) ;
41+ assert . true ( abilitiesService . can ( 'read account' , account ) ) ;
4242 account . type = TYPE_AUTH_METHOD_LDAP ;
43- assert . true ( canService . can ( 'read account' , account ) ) ;
43+ assert . true ( abilitiesService . can ( 'read account' , account ) ) ;
4444 account . type = 'no-such-type' ;
45- assert . false ( canService . can ( 'read account' , account ) ) ;
45+ assert . false ( abilitiesService . can ( 'read account' , account ) ) ;
4646 } ) ;
4747
4848 test ( 'cannot read accounts when unauthorized' , function ( assert ) {
4949 const account = store . createRecord ( 'account' , {
5050 authorized_actions : [ ] ,
5151 type : TYPE_AUTH_METHOD_OIDC ,
5252 } ) ;
53- assert . false ( canService . can ( 'read account' , account ) ) ;
53+ assert . false ( abilitiesService . can ( 'read account' , account ) ) ;
5454 account . type = TYPE_AUTH_METHOD_PASSWORD ;
55- assert . false ( canService . can ( 'read account' , account ) ) ;
55+ assert . false ( abilitiesService . can ( 'read account' , account ) ) ;
5656 account . type = TYPE_AUTH_METHOD_LDAP ;
57- assert . false ( canService . can ( 'read account' , account ) ) ;
57+ assert . false ( abilitiesService . can ( 'read account' , account ) ) ;
5858 account . type = 'no-such-type' ;
59- assert . false ( canService . can ( 'read account' , account ) ) ;
59+ assert . false ( abilitiesService . can ( 'read account' , account ) ) ;
6060 } ) ;
6161
6262 test ( 'can delete known account types when authorized' , function ( assert ) {
6363 const account = store . createRecord ( 'account' , {
6464 authorized_actions : [ 'delete' ] ,
6565 type : TYPE_AUTH_METHOD_OIDC ,
6666 } ) ;
67- assert . true ( canService . can ( 'delete account' , account ) ) ;
67+ assert . true ( abilitiesService . can ( 'delete account' , account ) ) ;
6868 account . type = TYPE_AUTH_METHOD_PASSWORD ;
69- assert . true ( canService . can ( 'delete account' , account ) ) ;
69+ assert . true ( abilitiesService . can ( 'delete account' , account ) ) ;
7070 account . type = TYPE_AUTH_METHOD_LDAP ;
71- assert . true ( canService . can ( 'delete account' , account ) ) ;
71+ assert . true ( abilitiesService . can ( 'delete account' , account ) ) ;
7272 account . type = 'no-such-type' ;
73- assert . false ( canService . can ( 'delete account' , account ) ) ;
73+ assert . false ( abilitiesService . can ( 'delete account' , account ) ) ;
7474 } ) ;
7575
7676 test ( 'cannot delete accounts when unauthorized' , function ( assert ) {
7777 const account = store . createRecord ( 'account' , {
7878 authorized_actions : [ 'delete' ] ,
7979 type : TYPE_AUTH_METHOD_OIDC ,
8080 } ) ;
81- assert . true ( canService . can ( 'delete account' , account ) ) ;
81+ assert . true ( abilitiesService . can ( 'delete account' , account ) ) ;
8282 account . type = TYPE_AUTH_METHOD_PASSWORD ;
83- assert . true ( canService . can ( 'delete account' , account ) ) ;
83+ assert . true ( abilitiesService . can ( 'delete account' , account ) ) ;
8484 account . type = TYPE_AUTH_METHOD_LDAP ;
85- assert . true ( canService . can ( 'delete account' , account ) ) ;
85+ assert . true ( abilitiesService . can ( 'delete account' , account ) ) ;
8686 account . type = 'no-such-type' ;
87- assert . false ( canService . can ( 'delete account' , account ) ) ;
87+ assert . false ( abilitiesService . can ( 'delete account' , account ) ) ;
8888 } ) ;
8989
9090 test ( 'can update known account types when authorized' , function ( assert ) {
9191 const account = store . createRecord ( 'account' , {
9292 authorized_actions : [ 'update' ] ,
9393 type : TYPE_AUTH_METHOD_OIDC ,
9494 } ) ;
95- assert . true ( canService . can ( 'update account' , account ) ) ;
95+ assert . true ( abilitiesService . can ( 'update account' , account ) ) ;
9696 account . type = TYPE_AUTH_METHOD_PASSWORD ;
97- assert . true ( canService . can ( 'update account' , account ) ) ;
97+ assert . true ( abilitiesService . can ( 'update account' , account ) ) ;
9898 account . type = TYPE_AUTH_METHOD_LDAP ;
99- assert . true ( canService . can ( 'update account' , account ) ) ;
99+ assert . true ( abilitiesService . can ( 'update account' , account ) ) ;
100100 account . type = 'no-such-type' ;
101- assert . false ( canService . can ( 'update account' , account ) ) ;
101+ assert . false ( abilitiesService . can ( 'update account' , account ) ) ;
102102 } ) ;
103103
104104 test ( 'cannot update accounts when unauthorized' , function ( assert ) {
105105 const account = store . createRecord ( 'account' , {
106106 authorized_actions : [ ] ,
107107 type : TYPE_AUTH_METHOD_OIDC ,
108108 } ) ;
109- assert . false ( canService . can ( 'update account' , account ) ) ;
109+ assert . false ( abilitiesService . can ( 'update account' , account ) ) ;
110110 account . type = TYPE_AUTH_METHOD_PASSWORD ;
111- assert . false ( canService . can ( 'update account' , account ) ) ;
111+ assert . false ( abilitiesService . can ( 'update account' , account ) ) ;
112112 account . type = TYPE_AUTH_METHOD_LDAP ;
113- assert . false ( canService . can ( 'update account' , account ) ) ;
113+ assert . false ( abilitiesService . can ( 'update account' , account ) ) ;
114114 account . type = 'no-such-type' ;
115- assert . false ( canService . can ( 'update account' , account ) ) ;
115+ assert . false ( abilitiesService . can ( 'update account' , account ) ) ;
116116 } ) ;
117117} ) ;
0 commit comments