File: setupHelpers.h

package info (click to toggle)
eris 1.3.14-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 3,016 kB
  • ctags: 1,819
  • sloc: cpp: 13,153; sh: 9,106; perl: 287; makefile: 201; ansic: 165
file content (46 lines) | stat: -rw-r--r-- 1,048 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef TEST_SETUP_HELPERS_H
#define TEST_SETUP_HELPERS_H

#include <Eris/Connection.h>
#include <Eris/Account.h>
#include <Eris/Avatar.h>

typedef std::auto_ptr<Eris::Connection> AutoConnection;
typedef std::auto_ptr<Eris::Account> AutoAccount;
typedef std::auto_ptr<Eris::Avatar> AutoAvatar;

AutoConnection stdConnect();

AutoAccount stdLogin(const std::string& uname, 
                    const std::string& pwd, Eris::Connection* con);

class AvatarGetter
{
public:
    AvatarGetter(Eris::Account* acc);
        
    void expectFailure()
    {
        m_expectFail = true;
    }
    
    void returnOnSuccess()
    {
        m_earlyReturn = true;
    }
    
    AutoAvatar take(const std::string& charId);
    AutoAvatar create(const Atlas::Objects::Entity::RootEntity& charEnt);
    
private:
    void success(Eris::Avatar* av);    
    void failure(const std::string& msg);
    
    bool m_waiting;
    Eris::Account* m_acc;
    AutoAvatar m_av;
    bool m_expectFail, m_failed;
    bool m_earlyReturn;
};

#endif // of TEST_SETUP_HELPERS_H