Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
fix: adapt asserts to ok/eq_
Browse files Browse the repository at this point in the history
issue #674
  • Loading branch information
pjenvey committed Oct 4, 2016
1 parent 9b83d9c commit e9fd8a1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
16 changes: 8 additions & 8 deletions autopush/tests/test_db.py
Expand Up @@ -151,8 +151,8 @@ def test_provisioning(self):
db_name = "storage_%s" % uuid.uuid4()

s = create_storage_table(db_name, 8, 11)
assert s.throughput["read"] == 8
assert s.throughput["write"] == 11
eq_(s.throughput["read"], 8)
eq_(s.throughput["write"], 11)

def test_dont_save_older(self):
s = get_storage_table()
Expand Down Expand Up @@ -236,7 +236,7 @@ def test_register(self):
# Verify its in the db
rows = m.query_2(uaid__eq=self.uaid, chidmessageid__eq=" ")
results = list(rows)
assert(len(results) == 1)
eq_(len(results), 1)

def test_unregister(self):
chid = str(uuid.uuid4())
Expand All @@ -247,15 +247,15 @@ def test_unregister(self):
# Verify its in the db
rows = m.query_2(uaid__eq=self.uaid, chidmessageid__eq=" ")
results = list(rows)
assert(len(results) == 1)
eq_(len(results), 1)
eq_(results[0]["chids"], set([chid]))

message.unregister_channel(self.uaid, chid)

# Verify its not in the db
rows = m.query_2(uaid__eq=self.uaid, chidmessageid__eq=" ")
results = list(rows)
assert(len(results) == 1)
eq_(len(results), 1)
eq_(results[0]["chids"], None)

# Test for the very unlikely case that there's no 'chid'
Expand Down Expand Up @@ -301,7 +301,7 @@ def test_all_channels_no_uaid(self):
m = get_rotating_message_table()
message = Message(m, SinkMetrics())
exists, chans = message.all_channels(dummy_uaid)
assert(chans == set([]))
eq_(chans, set([]))

def test_message_storage(self):
chid = str(uuid.uuid4())
Expand Down Expand Up @@ -396,8 +396,8 @@ def test_provisioning(self):
db_name = "router_%s" % uuid.uuid4()

r = create_router_table(db_name, 3, 17)
assert r.throughput["read"] == 3
assert r.throughput["write"] == 17
eq_(r.throughput["read"], 3)
eq_(r.throughput["write"], 17)

def test_no_uaid_found(self):
uaid = str(uuid.uuid4())
Expand Down
3 changes: 2 additions & 1 deletion autopush/tests/test_diagnostic_cli.py
Expand Up @@ -37,7 +37,8 @@ def test_bad_endpoint(self):
"--router_tablename=fred",
"http://someendpoint",
])
assert cli.run()
returncode = cli.run()
ok_(returncode not in (None, 0))

@patch("autopush.diagnostic_cli.AutopushSettings")
def test_successfull_lookup(self, mock_settings_class):
Expand Down
6 changes: 4 additions & 2 deletions autopush/tests/test_main.py
Expand Up @@ -280,15 +280,17 @@ def test_ssl(self):
], False)

def test_bad_senderidlist(self):
assert endpoint_main([
returncode = endpoint_main([
"--gcm_enabled",
"--senderid_list='[Invalid'"
], False)
ok_(returncode not in (None, 0))

def test_bad_apnsconf(self):
assert endpoint_main([
returncode = endpoint_main([
"--apns_creds='[Invalid'"
], False)
ok_(returncode not in (None, 0))

def test_client_certs(self):
cert = self.TestArg._client_certs['partner1'][0]
Expand Down

0 comments on commit e9fd8a1

Please sign in to comment.