Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
admin-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pleroma
admin-fe
Commits
cd92dfa6
Commit
cd92dfa6
authored
4 years ago
by
Angelina Filippova
Browse files
Options
Downloads
Patches
Plain Diff
Add test for updating actor_type
parent
2a42c5ed
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!161
Allow setting actor_type field via Admin API.
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/api/__mocks__/status.js
+4
-4
4 additions, 4 deletions
src/api/__mocks__/status.js
src/api/__mocks__/users.js
+8
-4
8 additions, 4 deletions
src/api/__mocks__/users.js
test/views/users/index.test.js
+19
-0
19 additions, 0 deletions
test/views/users/index.test.js
with
31 additions
and
8 deletions
src/api/__mocks__/status.js
+
4
−
4
View file @
cd92dfa6
...
...
@@ -55,11 +55,11 @@ export async function fetchStatusesByInstance({ instance, authHost, token, pageS
'
nickname
'
:
'
sky
'
,
'
url
'
:
'
http://localhost:4000/users/sky
'
},
'
content
'
:
'
A nice young couple contacted us from Brazil to decorate their newly acquired apartment.
'
,
'
created_at
'
:
'
2020-0
1-31
T18:20:01.000Z
'
,
'
id
'
:
'
9rZIr0Jza
o5Gjgfmro
'
,
'
content
'
:
'
i love parks&rec
'
,
'
created_at
'
:
'
2020-0
4-12
T18:20:01.000Z
'
,
'
id
'
:
'
o5Gjgfmro
9rZIr0Jza
'
,
'
sensitive
'
:
false
,
'
url
'
:
'
http://localhost:4000/objects/7af9abbd-
fb6c-4318-
aeb7-6636c138ac98
'
,
'
url
'
:
'
http://localhost:4000/objects/7af9abbd-aeb7-6636c138ac98
-fb6c-4318
'
,
'
visibility
'
:
'
unlisted
'
},
{
...
...
This diff is collapsed.
Click to expand it.
src/api/__mocks__/users.js
+
8
−
4
View file @
cd92dfa6
export
let
users
=
[
{
active
:
true
,
approval_pending
:
false
,
deactivated
:
false
,
id
:
'
2
'
,
nickname
:
'
allis
'
,
local
:
true
,
external
:
false
,
roles
:
{
admin
:
true
,
moderator
:
false
},
tags
:
[]
},
{
active
:
true
,
approval_pending
:
false
,
deactivated
:
false
,
id
:
'
10
'
,
nickname
:
'
bob
'
,
local
:
false
,
external
:
true
,
roles
:
{
admin
:
false
,
moderator
:
false
},
tags
:
[
'
mrf_tag:sandbox
'
]
},
{
active
:
false
,
approval_pending
:
false
,
deactivated
:
true
,
id
:
'
abc
'
,
nickname
:
'
john
'
,
local
:
true
,
external
:
false
,
roles
:
{
admin
:
false
,
moderator
:
false
},
tags
:
[
'
mrf_tag:media-strip
'
]
},
{
active
:
true
,
approval_pending
:
true
,
deactivated
:
false
,
id
:
'
100
'
,
nickname
:
'
sally
'
,
local
:
true
,
external
:
false
,
roles
:
{
admin
:
false
,
moderator
:
false
},
tags
:
[]
}
{
active
:
true
,
approval_pending
:
false
,
deactivated
:
false
,
id
:
'
2
'
,
nickname
:
'
allis
'
,
local
:
true
,
external
:
false
,
roles
:
{
admin
:
true
,
moderator
:
false
},
tags
:
[]
,
actor_type
:
'
Person
'
},
{
active
:
true
,
approval_pending
:
false
,
deactivated
:
false
,
id
:
'
10
'
,
nickname
:
'
bob
'
,
local
:
false
,
external
:
true
,
roles
:
{
admin
:
false
,
moderator
:
false
},
tags
:
[
'
mrf_tag:sandbox
'
]
,
actor_type
:
'
Person
'
},
{
active
:
false
,
approval_pending
:
false
,
deactivated
:
true
,
id
:
'
abc
'
,
nickname
:
'
john
'
,
local
:
true
,
external
:
false
,
roles
:
{
admin
:
false
,
moderator
:
false
},
tags
:
[
'
mrf_tag:media-strip
'
]
,
actor_type
:
'
Person
'
},
{
active
:
true
,
approval_pending
:
true
,
deactivated
:
false
,
id
:
'
100
'
,
nickname
:
'
sally
'
,
local
:
true
,
external
:
false
,
roles
:
{
admin
:
false
,
moderator
:
false
},
tags
:
[]
,
actor_type
:
'
Service
'
}
]
const
userProfile
=
{
avatar
:
'
avatar.jpg
'
,
nickname
:
'
allis
'
,
id
:
'
2
'
,
tags
:
[],
roles
:
{
admin
:
true
,
moderator
:
false
},
local
:
true
,
external
:
false
}
...
...
@@ -119,3 +119,7 @@ export async function createNewAccount(nickname, email, password, authHost, toke
users
=
[...
users
,
newUser
]
return
Promise
.
resolve
()
}
export
async
function
updateUserCredentials
(
nickname
,
credentials
,
authHost
,
token
)
{
return
Promise
.
resolve
()
}
This diff is collapsed.
Click to expand it.
test/views/users/index.test.js
+
19
−
0
View file @
cd92dfa6
...
...
@@ -353,7 +353,26 @@ describe('Creates new account', () => {
expect
(
wrapper
.
vm
.
validatePassword
(
validatePasswordRule
,
''
,
identity
)).
toBeInstanceOf
(
Error
)
expect
(
wrapper
.
vm
.
validatePassword
(
validatePasswordRule
,
'
1234
'
,
identity
)).
toBeUndefined
()
})
it
(
'
updates actor type
'
,
async
(
done
)
=>
{
const
wrapper
=
mount
(
Users
,
{
store
,
localVue
,
sync
:
false
,
stubs
:
[
'
router-link
'
]
})
await
flushPromises
()
const
user
=
store
.
state
.
users
.
fetchedUsers
[
0
]
expect
(
user
.
actor_type
).
toBe
(
'
Person
'
)
const
findWrapper
=
(
trChild
,
liChild1
,
liChild2
)
=>
`.el-table__fixed-body-wrapper table tr:nth-child(
${
trChild
}
) ul.el-dropdown-menu > li:nth-child(
${
liChild1
}
) ul li:nth-child(
${
liChild2
}
)`
wrapper
.
find
(
findWrapper
(
1
,
1
,
1
)).
trigger
(
'
click
'
)
const
updatedUser
=
store
.
state
.
users
.
fetchedUsers
[
0
]
expect
(
updatedUser
.
actor_type
).
toBe
(
'
Service
'
)
done
()
})
})
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment