blob: 8a44a9728c04bde1f6f1af47e6af782c96ebc3ed (
plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#!/usr/bin/python
import os
import unittest
import xmlrpclib
import func.overlord.client as fc
class BaseTest:
th = "grimlock.devel.redhat.com"
def __init__(self):
pass
def setUp(self):
self.client = fc.Client(self.th)
class TestTest(BaseTest):
def test_add(self):
result = self.client.test.add(1,5)
assert result[self.th] == 6
def test_add_string(self):
result = self.client.test.add("foo", "bar")
assert result[self.th] == "foobar"
def tearDown(self):
pass
class TestCommand(BaseTest):
def test_echo(self):
result = self.client.command.run("echo -n foo")
assert result[self.th][1] == "foo"
def test_rpm(self):
result = self.client.command.run("rpm -q func")
assert result[self.th][1].split("-")[0] == "func"
class TestCopyfile(BaseTest):
fn = "/tmp/func_test_file"
content = "this is a func test file"
def create_a_file(self):
f = open(self.fn, "w")
f.write(self.content)
f.close()
def test_copyfile(self):
"run a test case"
self.create_a_file()
fb = open(self.fn,"r").read()
print fb
data = xmlrpclib.Binary(fb)
result = self.client.copyfile.copyfile(self.fn, data)
assert result[self.th] == 0
#f = TestBar()
#f.test_add()
|