def setUp(self): logstream.truncate() rmtree(self.testing_playground) print os.getcwd() os.makedirs(self.testing_playground) self.old_working_directory = os.getcwd() os.chdir(self.testing_playground) self.base_directory = os.getcwd() self.server = Server(listen_address, listen_port, server_key, users, repositories, False)
class TestBase(object): testing_playground = 'testing_playground' clone1 = 'test_repo1' clone2 = 'test_repo2' def setUp(self): logstream.truncate() rmtree(self.testing_playground) print os.getcwd() os.makedirs(self.testing_playground) self.old_working_directory = os.getcwd() os.chdir(self.testing_playground) self.base_directory = os.getcwd() self.server = Server(listen_address, listen_port, server_key, users, repositories, False) def tearDown(self): self.server.server_close() os.chdir(self.old_working_directory) rmtree(self.testing_playground) logstream.truncate() def assertListEndsWith(self, lst1, lst2, msg=None): return self.assertListEqual(lst1[-len(lst2):], lst2, msg)
listen_address = '127.0.0.1' # allow connections from localhost only! # listen_address = '' # uncomment to allow connections from all interfaces listen_port = 27015 # Add users and their public keys. users = { 'test_user' : 'AAAAB3NzaC1yc2EAAAADAQABAAAAgQC2GVRnNff5RjWqeR8F8ZqZkslDsW6Fqqe3cwGTB2zTs088JK/xZxz6u2CztMRDN7FK2Y0jVVktMWTlIB6PhMCs+IYVjo1vdEKuSfifVaInA+lPUwHOju+P76bf9NxFKYGWDxjx8Nuad4kKXz8lYJmC2BpocUftmvBHMfKY7kf/IQ==', } # Add repositories and lists of users that are allowed full access. # Repositiories will be stored in $PWD/repositories, '.git' extension # (since they will be created as bare) must _not_ be specified here. repositories = { 'test_repo' : ['test_user'], } if __name__ == '__main__': server = Server( listen_address, listen_port, server_key, users, repositories ) #print 'waiting for single request' #server.handle_request() server.serve_forever()