1from lib import BaseTest
2
3
4class MoveRepo1Test(BaseTest):
5    """
6    move in local repo: simple move
7    """
8    fixtureCmds = [
9        "aptly repo create -comment=Cool -distribution=squeeze repo1",
10        "aptly repo create -comment=Cool -distribution=squeeze repo2",
11        "aptly repo add repo1 ${files}"
12    ]
13    runCmd = "aptly repo move repo1 repo2 'pyspi (>> 0.6.1-1.3)' libboost-program-options-dev_1.49.0.1_i386"
14
15    def check(self):
16        self.check_output()
17        self.check_cmd_output("aptly repo show -with-packages repo1", "repo1_show")
18        self.check_cmd_output("aptly repo show -with-packages repo2", "repo2_show")
19
20    def output_processor(self, output):
21        return "\n".join(sorted(output.split("\n")))
22
23
24class MoveRepo2Test(BaseTest):
25    """
26    move in local repo: simple move w/deps
27    """
28    fixtureCmds = [
29        "aptly repo create -comment=Cool -distribution=squeeze repo1",
30        "aptly repo create -comment=Cool -distribution=squeeze repo2",
31        "aptly repo add repo1 ${files}"
32    ]
33    runCmd = "aptly -architectures=i386,amd64 repo move -with-deps repo1 repo2 'pyspi (>> 0.6.1-1.3)' libboost-program-options-dev_1.49.0.1_i386"
34
35    def check(self):
36        self.check_output()
37        self.check_cmd_output("aptly repo show -with-packages repo1", "repo1_show")
38        self.check_cmd_output("aptly repo show -with-packages repo2", "repo2_show")
39
40    def output_processor(self, output):
41        return "\n".join(sorted(output.split("\n")))
42
43
44class MoveRepo3Test(BaseTest):
45    """
46    move in local repo: simple move w/deps but w/o archs
47    """
48    fixtureCmds = [
49        "aptly repo create -comment=Cool -distribution=squeeze repo1",
50        "aptly repo create -comment=Cool -distribution=squeeze repo2",
51        "aptly repo add repo1 ${files}"
52    ]
53    runCmd = "aptly repo move -with-deps repo1 repo2 'pyspi (>> 0.6.1-1.3)' libboost-program-options-dev_1.49.0.1_i386"
54    expectedCode = 1
55
56    def output_processor(self, output):
57        return "\n".join(sorted(output.split("\n")))
58
59
60class MoveRepo4Test(BaseTest):
61    """
62    move in local repo: dry run
63    """
64    fixtureCmds = [
65        "aptly repo create -comment=Cool -distribution=squeeze repo1",
66        "aptly repo create -comment=Cool -distribution=squeeze repo2",
67        "aptly repo add repo1 ${files}"
68    ]
69    runCmd = "aptly repo move -dry-run repo1 repo2 'pyspi (>> 0.6.1-1.3)' libboost-program-options-dev_1.49.0.1_i386"
70
71    def check(self):
72        self.check_output()
73        self.check_cmd_output("aptly repo show -with-packages repo1", "repo1_show")
74        self.check_cmd_output("aptly repo show -with-packages repo2", "repo2_show")
75
76    def output_processor(self, output):
77        return "\n".join(sorted(output.split("\n")))
78
79
80class MoveRepo5Test(BaseTest):
81    """
82    move in local repo: wrong dep
83    """
84    fixtureCmds = [
85        "aptly repo create -comment=Cool -distribution=squeeze repo1",
86        "aptly repo create -comment=Cool -distribution=squeeze repo2",
87        "aptly repo add repo1 ${files}"
88    ]
89    runCmd = "aptly repo move repo1 repo2 'pyspi >> 0.6.1-1.3)'"
90    expectedCode = 1
91
92    def output_processor(self, output):
93        return "\n".join(sorted(output.split("\n")))
94
95
96class MoveRepo6Test(BaseTest):
97    """
98    move in local repo: same src and dest
99    """
100    fixtureCmds = [
101        "aptly repo create -comment=Cool -distribution=squeeze repo1",
102    ]
103    runCmd = "aptly repo move repo1 repo1 pyspi"
104    expectedCode = 1
105
106
107class MoveRepo7Test(BaseTest):
108    """
109    move in local repo: no dst
110    """
111    fixtureCmds = [
112        "aptly repo create -comment=Cool -distribution=squeeze repo1",
113    ]
114    runCmd = "aptly repo move repo1 repo2 pyspi"
115    expectedCode = 1
116
117
118class MoveRepo8Test(BaseTest):
119    """
120    move in local repo: no src
121    """
122    fixtureCmds = [
123        "aptly repo create -comment=Cool -distribution=squeeze repo2",
124    ]
125    runCmd = "aptly repo move repo1 repo2 pyspi"
126    expectedCode = 1
127