Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
Merge 2698fb4 into 977e5cc
Browse files Browse the repository at this point in the history
  • Loading branch information
arnisoph committed Oct 8, 2016
2 parents 977e5cc + 2698fb4 commit e3492dd
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ stages:
echo -e "FROM ${DOCKER_IMAGE}\nCOPY . /code" > Dockerfile.tmp
if [ "${START_INTEGRATION_SERVERS}" = 'yes' ]; then
CID_IMAPSERVER=$(docker run -d -p 143 -p 993 -p 6379 -v /dev/random:/dev/random bechtoldt/tabellarius_tests-docker)
CID_IMAPSERVER=$(docker run -d -p 143 -p 993 -p 6379 -v /dev/random:/dev/random:ro bechtoldt/tabellarius_tests-docker)
INTEGRATION_ADDR_IMAPSERVER=$(docker inspect -f '{{ .NetworkSettings.IPAddress }}' ${CID_IMAPSERVER})
echo -e "\nENV INTEGRATION_ADDR_IMAPSERVER=${INTEGRATION_ADDR_IMAPSERVER}" >> Dockerfile.tmp
fi
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ install:
script:
- |
if [ "${START_INTEGRATION_SERVERS}" = 'yes' ]; then
CID_IMAPSERVER=$(docker run -d -p 10143:143 -p 10993:993 -p 6379:6379 -v /dev/random:/dev/random bechtoldt/tabellarius_tests-docker)
CID_IMAPSERVER=$(docker run -d -p 10143:143 -p 10993:993 -p 6379:6379 -v /dev/random:/dev/random:ro bechtoldt/tabellarius_tests-docker)
export INTEGRATION_PORT_IMAP=10143
export INTEGRATION_PORT_IMAPS=10993
export INTEGRATION_ADDR_IMAPSERVER=127.0.0.1
Expand Down
9 changes: 9 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ Testing

Integration tests require a running Docker daemon with Internet connection. The `container image <https://hub.docker.com/r/bechtoldt/tabellarius_tests-docker/>`_ that is beeing downloaded contains Dovecot and Redis.

Start the Docker container:

::

$ docker run -d -p 10143:143 -p 10993:993 -p 6379:6379 -v /dev/random:/dev/random:ro bechtoldt/tabellarius_tests-docker
$ export INTEGRATION_PORT_IMAP=10143 INTEGRATION_PORT_IMAPS=10993 INTEGRATION_ADDR_IMAPSERVER=$(docker-machine ip docker-dev)

Notice: I'm gathering the IP addr via docker-machine, your own process may vary.

Run integration tests:

::
Expand Down
2 changes: 1 addition & 1 deletion tabellarius/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def parse_directory(self):
for file_name in files:
file_path = '{0}/{1}'.format(dirname, file_name)
if file_name.endswith('.yaml'):
with open(file_path, 'r') as stream:
with open(file_path, 'rb') as stream:
data = yaml.load(stream)
if data:
for root, value in data.items():
Expand Down
17 changes: 9 additions & 8 deletions tests/integration/test_imap.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,15 @@ def test_connect_imaps(self):

def test_connect_error_refused(self):
username, password = self.create_imap_user()
self.assertEqual(imap.IMAP(logger=self.logger,
server=self.INTEGRATION_ADDR_IMAPSERVER,
port=1337,
starttls=False,
imaps=True,
tlsverify=False, # TODO test tls verification?
username=username,
password=password).connect(), (False, '[Errno 111] Connection refused'))
self.assertIn(imap.IMAP(logger=self.logger,
server=self.INTEGRATION_ADDR_IMAPSERVER,
port=1337,
starttls=False,
imaps=True,
tlsverify=False, # TODO test tls verification?
username=username,
password=password).connect(), [(False, '[Errno 111] Connection refused'),
(False, '[Errno 61] Connection refused')])

def test_process_error(self):
try:
Expand Down

0 comments on commit e3492dd

Please sign in to comment.