def setUp(self): db_pool = SQLiteMemoryDbPool() yield db_pool.prepare() hs = HomeServer( "test", db_pool=db_pool, ) self.store = ProfileStore(hs) self.u_frank = hs.parse_userid("@frank:test")
def setUp(self): db_pool = SQLiteMemoryDbPool() yield db_pool.prepare() hs = HomeServer("test", db_pool=db_pool, ) self.store = ProfileStore(hs) self.u_frank = hs.parse_userid("@frank:test")
class ProfileStoreTestCase(unittest.TestCase): @defer.inlineCallbacks def setUp(self): hs = yield setup_test_homeserver(self.addCleanup) self.store = ProfileStore(None, hs) self.u_frank = UserID.from_string("@frank:test") @defer.inlineCallbacks def test_displayname(self): yield self.store.create_profile(self.u_frank.localpart) yield self.store.set_profile_displayname(self.u_frank.localpart, "Frank") self.assertEquals( "Frank", (yield self.store.get_profile_displayname(self.u_frank.localpart))) @defer.inlineCallbacks def test_avatar_url(self): yield self.store.create_profile(self.u_frank.localpart) yield self.store.set_profile_avatar_url(self.u_frank.localpart, "http://my.site/here") self.assertEquals( "http://my.site/here", (yield self.store.get_profile_avatar_url(self.u_frank.localpart)), )
class ProfileStoreTestCase(unittest.TestCase): @defer.inlineCallbacks def setUp(self): hs = yield setup_test_homeserver(self.addCleanup) self.store = ProfileStore(hs.get_db_conn(), hs) self.u_frank = UserID.from_string("@frank:test") @defer.inlineCallbacks def test_displayname(self): yield self.store.create_profile(self.u_frank.localpart) yield self.store.set_profile_displayname(self.u_frank.localpart, "Frank") self.assertEquals( "Frank", (yield self.store.get_profile_displayname(self.u_frank.localpart)) ) @defer.inlineCallbacks def test_avatar_url(self): yield self.store.create_profile(self.u_frank.localpart) yield self.store.set_profile_avatar_url( self.u_frank.localpart, "http://my.site/here" ) self.assertEquals( "http://my.site/here", (yield self.store.get_profile_avatar_url(self.u_frank.localpart)), )
class ProfileStoreTestCase(unittest.TestCase): @defer.inlineCallbacks def setUp(self): db_pool = SQLiteMemoryDbPool() yield db_pool.prepare() hs = HomeServer("test", db_pool=db_pool, ) self.store = ProfileStore(hs) self.u_frank = hs.parse_userid("@frank:test") @defer.inlineCallbacks def test_displayname(self): yield self.store.create_profile( self.u_frank.localpart ) yield self.store.set_profile_displayname( self.u_frank.localpart, "Frank" ) self.assertEquals( "Frank", (yield self.store.get_profile_displayname(self.u_frank.localpart)) ) @defer.inlineCallbacks def test_avatar_url(self): yield self.store.create_profile( self.u_frank.localpart ) yield self.store.set_profile_avatar_url( self.u_frank.localpart, "http://my.site/here" ) self.assertEquals( "http://my.site/here", (yield self.store.get_profile_avatar_url(self.u_frank.localpart)) )
class ProfileStoreTestCase(unittest.TestCase): @defer.inlineCallbacks def setUp(self): db_pool = SQLiteMemoryDbPool() yield db_pool.prepare() hs = HomeServer( "test", db_pool=db_pool, ) self.store = ProfileStore(hs) self.u_frank = hs.parse_userid("@frank:test") @defer.inlineCallbacks def test_displayname(self): yield self.store.create_profile(self.u_frank.localpart) yield self.store.set_profile_displayname(self.u_frank.localpart, "Frank") self.assertEquals( "Frank", (yield self.store.get_profile_displayname(self.u_frank.localpart))) @defer.inlineCallbacks def test_avatar_url(self): yield self.store.create_profile(self.u_frank.localpart) yield self.store.set_profile_avatar_url(self.u_frank.localpart, "http://my.site/here") self.assertEquals( "http://my.site/here", (yield self.store.get_profile_avatar_url(self.u_frank.localpart)))
def setUp(self): hs = yield setup_test_homeserver() self.store = ProfileStore(hs) self.u_frank = UserID.from_string("@frank:test")
def setUp(self): hs = yield setup_test_homeserver(self.addCleanup) self.store = ProfileStore(None, hs) self.u_frank = UserID.from_string("@frank:test")
def setUp(self): hs = yield setup_test_homeserver(self.addCleanup) self.store = ProfileStore(hs.get_db_conn(), hs) self.u_frank = UserID.from_string("@frank:test")