forked from Scout24/yum-repo-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmoketests.py
36 lines (25 loc) · 1.28 KB
/
smoketests.py
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
import unittest
import os
import httplib
import sys
sys.path.append('src/main/python')
sys.path.append('client/src/main/python')
from yum_repo_client.repoclient import HttpClient
from yum_repo_server.test.integrationTestHelper import IntegrationTestHelper
from yum_repo_server.test import unique_repo_name
class TestRemoteServer(unittest.TestCase):
HOST_NAME = os.environ['TESTSERVER_NAME']
PORT = int(os.environ.get('TESTSERVER_PORT', 80))
def test_remote_server(self):
repoclient = HttpClient(self.HOST_NAME, self.PORT)
helper = IntegrationTestHelper(self.HOST_NAME, self.PORT)
self.assertEquals(httplib.OK, helper.do_http_get('/repo/').status, 'returned response was not ok (200).')
repo_name = unique_repo_name()
repoclient.createStaticRepo(repo_name)
repoclient.uploadRpm(repo_name, 'src/test/resources/test-artifact.rpm')
path_to_rpm = "/repo/%s/noarch/test-artifact-1.2-1.noarch.rpm" % (repo_name)
self.assertEquals(httplib.OK, helper.do_http_get(path_to_rpm).status)
repoclient.generateMetadata(repo_name)
self.assertEquals(httplib.OK, helper.do_http_get('/repo/%s/repodata/repomd.xml' % repo_name).status)
if __name__ == '__main__':
unittest.main()