50c0ec176c
* add scopes to service auth impl * add error to getServiceAuth * send scoped tokens from pds * clean up privileged access scopes & allow simple service auth tokens for app passwords * integration into ozone * fix up bsky tests * cleanup xrpc-server tests * fix up tests & types * one more test * fix read after write tests * fix mod auth test * convert scopes to be a single method name * add scope check callback for auth verifier * pds changes only * fix feed generation tests * use scope for ozone service profile * dont verify scopes on pds yet * tidy * tidy imports * changeset * add tests * tidy * another changeset * scope -> lxm * tidy * clean up scope references * update nonce size * pr feedback * trim trailing slash * nonce -> jti * fix xrpc-server test * allow service auth on uploadBlob * fix build error * changeset * build, tidy * xrpc-server: update lxm claim check error * appview: temporarily permit labeler service calls to omit lxm claim * xrpc-server: fix test * changeset * fix merged tests --------- Co-authored-by: Devin Ivy <devinivy@gmail.com>
83 lines
2.6 KiB
TypeScript
83 lines
2.6 KiB
TypeScript
import { AtpAgent } from '@atproto/api'
|
|
import { TestNetwork, SeedClient, basicSeed } from '@atproto/dev-env'
|
|
import { ids } from '../../src/lexicon/lexicons'
|
|
|
|
describe('bsky account deactivation', () => {
|
|
let network: TestNetwork
|
|
let agent: AtpAgent
|
|
let sc: SeedClient
|
|
|
|
let alice: string
|
|
|
|
beforeAll(async () => {
|
|
network = await TestNetwork.create({
|
|
dbPostgresSchema: 'bsky_views_account_deactivation',
|
|
})
|
|
agent = network.bsky.getClient()
|
|
sc = network.getSeedClient()
|
|
await basicSeed(sc)
|
|
alice = sc.dids.alice
|
|
const pdsAgent = network.pds.getClient()
|
|
await pdsAgent.com.atproto.server.deactivateAccount(
|
|
{},
|
|
{ encoding: 'application/json', headers: sc.getHeaders(alice) },
|
|
)
|
|
await network.processAll()
|
|
})
|
|
|
|
afterAll(async () => {
|
|
await network.close()
|
|
})
|
|
|
|
it('does not return deactivated profiles', async () => {
|
|
const attempt = agent.api.app.bsky.actor.getProfile({
|
|
actor: alice,
|
|
})
|
|
await expect(attempt).rejects.toThrow('Account is deactivated')
|
|
const res = await agent.api.app.bsky.actor.getProfiles({
|
|
actors: [sc.dids.alice, sc.dids.bob, sc.dids.carol],
|
|
})
|
|
expect(res.data.profiles.length).toBe(2)
|
|
expect(res.data.profiles.some((p) => p.did === alice)).toBe(false)
|
|
})
|
|
|
|
it('does not return deactivated accounts in follows', async () => {
|
|
const follows = await agent.api.app.bsky.graph.getFollows({
|
|
actor: sc.dids.bob,
|
|
})
|
|
expect(follows.data.follows.some((f) => f.did === alice)).toBe(false)
|
|
const followers = await agent.api.app.bsky.graph.getFollowers({
|
|
actor: sc.dids.bob,
|
|
})
|
|
expect(followers.data.followers.some((f) => f.did === alice)).toBe(false)
|
|
})
|
|
|
|
it('does not return posts from deactivated accounts', async () => {
|
|
const uris = [
|
|
sc.posts[sc.dids.alice][0].ref.uriStr,
|
|
sc.posts[sc.dids.alice][1].ref.uriStr,
|
|
sc.posts[sc.dids.bob][0].ref.uriStr,
|
|
sc.posts[sc.dids.carol][0].ref.uriStr,
|
|
sc.posts[sc.dids.dan][1].ref.uriStr,
|
|
sc.replies[sc.dids.alice][0].ref.uriStr,
|
|
]
|
|
const res = await agent.api.app.bsky.feed.getPosts({ uris })
|
|
|
|
expect(res.data.posts.length).toBe(3)
|
|
expect(res.data.posts.some((p) => p.author.did === alice)).toBe(false)
|
|
})
|
|
|
|
it('does not return posts from deactivated in timelines', async () => {
|
|
const res = await agent.api.app.bsky.feed.getTimeline(
|
|
{},
|
|
{
|
|
headers: await network.serviceHeaders(
|
|
sc.dids.bob,
|
|
ids.AppBskyFeedGetTimeline,
|
|
),
|
|
},
|
|
)
|
|
expect(res.data.feed.some((p) => p.post.author.did === alice)).toBe(false)
|
|
})
|
|
})
|