Пример #1
0
 def setup(self):
     setting = yaml.load(open(SETTING_FILE).read())
     self.sqex_id = setting['sqex_id']
     self.passwd = setting['passwd']
     self.auth = Auth(self.sqex_id, self.passwd) 
     self.character = Character(self.FIXTURE_ID)
     self.my_chara = self.auth.characters[0]
Пример #2
0
class TestCharacter(object):
    FIXTURE_ID = '111362909909'
    def setup(self):
        setting = yaml.load(open(SETTING_FILE).read())
        self.sqex_id = setting['sqex_id']
        self.passwd = setting['passwd']
        self.auth = Auth(self.sqex_id, self.passwd) 
        self.character = Character(self.FIXTURE_ID)
        self.my_chara = self.auth.characters[0]
    
    def test_name(self):
        u"""キャラクター名が取得できる"""
        eq_(self.character.name, u'ぎぎにゃん', '名前が取得できる')

    def test_info(self):
        u"""それぞれの情報を取得できる"""
        ok_(self.character.species)
        eq_(self.character.sex, u'男')
        ok_(self.character.level)

    @raises(PermissionException)
    def test_photo_permission(self):
        u"""ログインしてないと写真を取得できない"""
        ok_(self.character.get_photos())

    @raises(PermissionException)
    def test_friend_permission(self):
        u"""ログインしてないとフレンドを取得できない"""
        ok_(self.character.get_friends())

    def test_photo(self):
        u"""自分の写真が取得できる"""
        ok_(self.my_chara.get_photos())

    def test_friends(self):
        u"""自分のフレンドが取得できる"""
        ok_(self.my_chara.get_friends())