Statistics
| Branch: | Tag: | Revision:

root / kamaki / cli / commands / test_cli.py @ 75c3fc42

History | View | Annotate | Download (3 kB)

1
# Copyright 2012-2013 GRNET S.A. All rights reserved.
2
#
3
# Redistribution and use in source and binary forms, with or
4
# without modification, are permitted provided that the following
5
# conditions are met:
6
#
7
#   1. Redistributions of source code must retain the above
8
#      copyright notice, this list of conditions and the following
9
#      disclaimer.
10
#
11
#   2. Redistributions in binary form must reproduce the above
12
#      copyright notice, this list of conditions and the following
13
#      disclaimer in the documentation and/or other materials
14
#      provided with the distribution.
15
#
16
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
# POSSIBILITY OF SUCH DAMAGE.
28
#
29
# The views and conclusions contained in the software and
30
# documentation are those of the authors and should not be
31
# interpreted as representing official policies, either expressed
32
# or implied, of GRNET S.A.command
33

    
34
from kamaki.cli import get_cmd_terms, command
35
from kamaki.cli.commands import _command_init
36
from kamaki.cli.command_tree import CommandTree
37
from kamaki.clients import tests
38

    
39
test_cmds = CommandTree('test', 'Unitest clients')
40
_commands = [test_cmds]
41

    
42

    
43
#print('Command Terms: ', get_cmd_terms())
44

    
45

    
46
class _test_init(_command_init):
47

    
48
    def main(self, client, method=None):
49
        if method:
50
            tests.main([client, method])
51
        else:
52
            tests.main([client])
53

    
54

    
55
@command(test_cmds)
56
class test_all(_test_init):
57
    """test all clients"""
58

    
59
    def main(self):
60
        for client in ('pithos', 'cyclades', 'image', 'astakos'):
61
            super(self.__class__, self).main(client)
62

    
63

    
64
@command(test_cmds)
65
class test_pithos(_test_init):
66
    """ test Pithos client"""
67

    
68
    def main(self, method=None):
69
        super(self.__class__, self).main('pithos', method)
70

    
71

    
72
@command(test_cmds)
73
class test_cyclades(_test_init):
74
    """ test Cyclades client"""
75

    
76
    def main(self, method=None):
77
        super(self.__class__, self).main('cyclades', method)
78

    
79

    
80
@command(test_cmds)
81
class test_image(_test_init):
82
    """ test Image client"""
83

    
84
    def main(self, method=None):
85
        super(self.__class__, self).main('image', method)
86

    
87

    
88
@command(test_cmds)
89
class test_astakos(_test_init):
90
    """ test Astakos client"""
91

    
92
    def main(self, method=None):
93
        super(self.__class__, self).main('astakos', method)
94

    
95

    
96
@command(test_cmds)
97
class test_lala_lele(_test_init):
98
    """test lala lele"""
99

    
100
    def main(self, *args):
101
        print('Do smth')