Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
coolamqp
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
coolamqp
Commits
b2fecb5d
Commit
b2fecb5d
authored
8 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
+tests
parent
3dcfc24c
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
Vagrantfile
+3
-3
3 additions, 3 deletions
Vagrantfile
setup.py
+2
-2
2 additions, 2 deletions
setup.py
tests/README.md
+3
-0
3 additions, 0 deletions
tests/README.md
tests/__init__.py
+0
-8
0 additions, 8 deletions
tests/__init__.py
tests/test_cluster.py
+36
-5
36 additions, 5 deletions
tests/test_cluster.py
with
44 additions
and
18 deletions
Vagrantfile
+
3
−
3
View file @
b2fecb5d
...
@@ -13,9 +13,9 @@ Vagrant.configure("2") do |config|
...
@@ -13,9 +13,9 @@ Vagrant.configure("2") do |config|
/usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management
/usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management
service rabbitmq-server restart
service rabbitmq-server restart
rabbitmqctl add_user
guest guest
rabbitmqctl add_user
user user
rabbitmqctl set_permissions -p /
guest
".*" ".*" ".*"
rabbitmqctl set_permissions -p /
user
".*" ".*" ".*"
rabbitmqctl set_user_tags
guest
administrator
rabbitmqctl set_user_tags
user
administrator
# Install deps
# Install deps
pip install -r /vagrant/requirements.txt
pip install -r /vagrant/requirements.txt
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
2
−
2
View file @
b2fecb5d
...
@@ -4,7 +4,7 @@ from distutils.core import setup
...
@@ -4,7 +4,7 @@ from distutils.core import setup
setup
(
name
=
'
CoolAMQP
'
,
setup
(
name
=
'
CoolAMQP
'
,
version
=
'
0.6
'
,
version
=
'
0.6
'
,
description
=
'
The AMQP client library
'
,
description
=
'
The
angry
AMQP client library
'
,
author
=
u
'
DMS Serwis s.c.
'
,
author
=
u
'
DMS Serwis s.c.
'
,
author_email
=
'
piotrm@smok.co
'
,
author_email
=
'
piotrm@smok.co
'
,
url
=
'
https://github.com/smok-serwis/coolamqp
'
,
url
=
'
https://github.com/smok-serwis/coolamqp
'
,
...
@@ -12,7 +12,7 @@ setup(name='CoolAMQP',
...
@@ -12,7 +12,7 @@ setup(name='CoolAMQP',
keywords
=
[
'
amqp
'
,
'
pyamqp
'
,
'
rabbitmq
'
,
'
client
'
,
'
network
'
,
'
ha
'
,
'
high availability
'
],
keywords
=
[
'
amqp
'
,
'
pyamqp
'
,
'
rabbitmq
'
,
'
client
'
,
'
network
'
,
'
ha
'
,
'
high availability
'
],
packages
=
[
'
coolamqp
'
,
'
coolamqp.backends
'
],
packages
=
[
'
coolamqp
'
,
'
coolamqp.backends
'
],
license
=
'
MIT License
'
,
license
=
'
MIT License
'
,
long_description
=
'''
The Python AMQP client library that makes you
forget about all the nasty corner cases about AMQP reconnection
'''
,
long_description
=
'''
The Python AMQP client library that makes you
STOP FUCKING WITH AMQP RECONNECTION
'''
,
requires
=
[
requires
=
[
"
amqp
"
,
"
amqp
"
,
"
six
"
"
six
"
...
...
This diff is collapsed.
Click to expand it.
tests/README.md
0 → 100644
+
3
−
0
View file @
b2fecb5d
Tests work using either Travis CI or Vagrant.
If you want to debug things, you have RabbitMQ management enabled on Vagrant. Go to http://127.0.0.1:15672 and log in with
**user**
/
**user**
This diff is collapsed.
Click to expand it.
tests/__init__.py
+
0
−
8
View file @
b2fecb5d
"""
Fucking all tests are integration, because why fuck you.
How the fuck do you unit test a fucking NETWORK CLIENT LIBRARY?
Are you going to FUCKING MOCK AN ENTIRE AMQP BROKER? Fuck you.
You can run them either using fucking Travis CI or fucking Vagrant, it does not
fucking matter.
"""
This diff is collapsed.
Click to expand it.
tests/test_cluster.py
+
36
−
5
View file @
b2fecb5d
...
@@ -2,12 +2,43 @@
...
@@ -2,12 +2,43 @@
from
__future__
import
absolute_import
,
division
,
print_function
from
__future__
import
absolute_import
,
division
,
print_function
import
unittest
import
unittest
from
coolamqp
import
Cluster
,
ClusterNode
,
Queue
,
MessageReceived
,
ConnectionUp
,
\
ConnectionDown
,
ConsumerCancelled
,
Message
from
coolamqp
import
Cluster
,
ClusterNode
class
MyTestCase
(
unittest
.
TestCase
):
class
MyTestCase
(
unittest
.
TestCase
):
def
test_connect
(
self
):
def
setUp
(
self
):
amqp
=
Cluster
([
ClusterNode
(
'
127.0.0.1
'
,
'
guest
'
,
'
guest
'
)])
self
.
amqp
=
Cluster
([
ClusterNode
(
'
127.0.0.1
'
,
'
guest
'
,
'
guest
'
)])
amqp
.
start
()
self
.
amqp
.
start
()
amqp
.
shutdown
(
)
self
.
assertIsInstance
(
self
.
amqp
.
drain
(
1
),
ConnectionUp
)
def
tearDown
(
self
):
self
.
amqp
.
shutdown
()
def
test_send_and_receive
(
self
):
myq
=
Queue
(
'
myqueue
'
,
exclusive
=
True
)
self
.
amqp
.
consume
(
myq
)
self
.
amqp
.
send
(
Message
(
b
'
what the fuck
'
),
''
,
routing_key
=
'
myqueue
'
)
p
=
self
.
amqp
.
drain
(
wait
=
10
)
self
.
assertIsInstance
(
p
,
MessageReceived
)
self
.
assertEquals
(
p
.
message
.
body
,
b
'
what the fuck
'
)
# def test_consumer_cancelled_on_queue_deletion(self):
# myq = Queue('myqueue', exclusive=True)
#
# self.amqp.consume(myq)
# self.amqp.delete_queue(myq)
#
# self.assertIsInstance(self.amqp.drain(wait=10), ConsumerCancelled)
def
test_consumer_cancelled_on_consumer_cancel
(
self
):
myq
=
Queue
(
'
myqueue
'
,
exclusive
=
True
)
self
.
amqp
.
consume
(
myq
)
self
.
amqp
.
cancel
(
myq
)
self
.
assertIsInstance
(
self
.
amqp
.
drain
(
wait
=
10
),
ConsumerCancelled
)
self
.
amqp
.
delete_queue
(
myq
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment