예제 #1
0
class AuthTest(unittest.TestCase):
    def setUp(self):
        self.auth = Plugin(FakeService({'plugins-libdir': '.'}), [])
        self.db = sqlite3.connect(self.auth.database)

    def tearDown(self):
        self.db.close()
        os.unlink(self.auth.database)

    @defer.inlineCallbacks
    def test02_create_emails(self):
        emails = [u'*****@*****.**', u'*****@*****.**', u'player']
        ids = yield self.auth.get_players_ids(emails, create=True)
        self.assertEquals([1, 2, 3], ids)

    @defer.inlineCallbacks
    def test03_get_name(self):
        name = yield self.auth.get_player_name(3)
        self.assertEquals("Player 3", name)

    @defer.inlineCallbacks
    def test04_get_player_avatar_url(self):
        avatar_url = yield self.auth.get_player_avatar_url('3')
        self.assertEquals('/static/css/images/avatars/default/3.jpg',
                          avatar_url)
예제 #2
0
class AuthTest(unittest.TestCase):

    def setUp(self):
        self.auth = Plugin(FakeService({'plugins-libdir': '.'}), [])
        self.db = sqlite3.connect(self.auth.database)

    def tearDown(self):
        self.db.close()
        os.unlink(self.auth.database)

    @defer.inlineCallbacks
    def test02_create_emails(self):
        emails = [u'*****@*****.**', u'*****@*****.**', u'player']
        ids = yield self.auth.get_players_ids(emails, create=True)
        self.assertEquals([1, 2, 3], ids)

    @defer.inlineCallbacks
    def test03_get_name(self):
        name = yield self.auth.get_player_name(3)
        self.assertEquals("Player 3", name)

    @defer.inlineCallbacks
    def test04_get_player_avatar_url(self):
        avatar_url = yield self.auth.get_player_avatar_url('3')
        self.assertEquals('/static/css/images/avatars/default/3.jpg', avatar_url)
예제 #3
0
 def setUp(self):
     self.auth = Plugin(FakeService({'plugins-libdir': '.'}), [])
     self.db = sqlite3.connect(self.auth.database)
예제 #4
0
 def test00_create(self):
     auth = Plugin(FakeService({'plugins-libdir': '.'}), [])
     self.assertTrue(os.path.exists(auth.database))
예제 #5
0
 def setUp(self):
     self.auth = Plugin(FakeService({'plugins-libdir': '.'}), [])
     self.db = sqlite3.connect(self.auth.database)