Skip to content
This repository was archived by the owner on Jan 12, 2022. It is now read-only.

Commit 7931e01

Browse files
author
Bryan Mau
committed
updated tests
1 parent 0f56851 commit 7931e01

5 files changed

Lines changed: 20 additions & 59 deletions

File tree

tests/e2e/tests/logging_test.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
"""E2E test for logging API.
2-
3-
Currently DOES NOT work.
4-
"""
1+
from google.appengine.api.logservice import logservice
52
import json
63
import logging
74
import os
85
import pytest
96

10-
from google.appengine.api.logservice import logservice
117

128

139
@pytest.fixture

tests/e2e/tests/memcache_test.py

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,16 @@
1-
"""Tests for the memcache API."""
2-
1+
from google.appengine.api import memcache
32
import pytest
43
import time
54

6-
from google.appengine.api import memcache
7-
8-
9-
@pytest.fixture
10-
def defaults():
11-
memcache.flush_all()
12-
return {
13-
'client': memcache._CLIENT,
14-
'mapping': {
15-
'key1', 'data1',
16-
'key2', 'data2',
17-
'key3', 'data3',
18-
},
19-
'timeout': 2,
20-
'timeout_tolerance': 2,
21-
'namespace1': 'foo',
22-
'namespace2': 'bar',
23-
'default_range': 10,
24-
'default_incr_start': 1,
25-
'default_decr_start': 1000,
26-
'default_delta': 10,
27-
}
28-
5+
key1 = 'key1'
6+
data1 = 'data1'
7+
timeout = 2
8+
timeout_tolerance = 2
299

30-
def test_memcache(defaults):
31-
assert memcache.get('key1') == None
32-
memcache.set('key1', 'data1')
33-
assert memcache.get('key1') == 'data1'
34-
assert memcache.set('key1', 'data1', defaults['timeout'])
35-
time.sleep(defaults['timeout'] + defaults['timeout_tolerance'])
36-
assert memcache.get('key1') == None
10+
def test_memcache():
11+
assert memcache.get(key1) == None
12+
memcache.set(key1, data1)
13+
assert memcache.get(key1) == data1
14+
assert memcache.set(key1, data1, timeout)
15+
time.sleep(timeout + timeout_tolerance)
16+
assert memcache.get(key1) == None

tests/e2e/tests/search_test.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
"""Tests for the search API."""
2-
1+
from google.appengine.api import search
32
import pytest
43
import time
54

6-
from google.appengine.api import search
7-
8-
95
@pytest.fixture
106
def index():
117
index = search.Index(name='simple-index', namespace='')

tests/e2e/tests/urlfetch_test.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
"""Tests for the urlfetch API."""
2-
1+
from google.appengine.api import urlfetch
32
import pytest
43
import time
54

6-
from google.appengine.api import urlfetch
7-
8-
9-
@pytest.fixture
10-
def url():
11-
return 'http://www.google.com'
5+
url = 'http://www.google.com'
126

13-
def test_urlfetch(url):
7+
def test_urlfetch():
148
resp = urlfetch.fetch(url)
159
assert resp.status_code == 200
1610
assert resp.headers['content-length'] == str(len(resp.content))

tests/e2e/tests/users_test.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
"""E2E test for Users API."""
2-
import pytest
3-
41
from google.appengine.api import users
2+
import pytest
53

4+
user = users.get_current_user()
65

7-
@pytest.fixture
8-
def user():
9-
return users.get_current_user()
10-
11-
def test_current_user(user):
6+
def test_current_user():
127
assert user == None

0 commit comments

Comments
 (0)