Skip to content

Commit 509a538

Browse files
NolanNolan
authored andcommitted
Finalized remote_lrs_test
2 parents 6dba225 + bbedd6a commit 509a538

23 files changed

+560
-585
lines changed

test/about_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/env python
2-
31
# Copyright 2014 Rustici Software
42
#
53
# Licensed under the Apache License, Version 2.0 (the "License");

test/attachment_test.py

Lines changed: 284 additions & 285 deletions
Large diffs are not rendered by default.

test/conversions/iso8601_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/env python
2-
31
# Copyright 2014 Rustici Software
42
#
53
# Licensed under the Apache License, Version 2.0 (the "License");

test/extensions_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/env python
2-
31
# Copyright 2014 Rustici Software
42
#
53
# Licensed under the Apache License, Version 2.0 (the "License");

test/http_request_test.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
# limitations under the License.
1414

1515
import unittest
16+
17+
if __name__ == '__main__':
18+
from main import setup_tincan_path
19+
setup_tincan_path()
1620
from tincan.http_request import HTTPRequest
1721

1822

@@ -27,7 +31,6 @@ def tearDown(self):
2731
def test_init_empty(self):
2832
req = HTTPRequest()
2933
self.assertIsInstance(req, HTTPRequest)
30-
self.assertFalse(hasattr(req, "endpoint"))
3134
self.assertFalse(hasattr(req, "content"))
3235
self.assertFalse(hasattr(req, "ignore404"))
3336

@@ -48,14 +51,14 @@ def test_init_kwarg_exception(self):
4851
HTTPRequest(bad_test="test")
4952

5053
def test_init_arg_exception_dict(self):
51-
d = {"bad_test": "test", "endpoint": "ok"}
54+
d = {"bad_test": "test", "resource": "ok"}
5255
with self.assertRaises(AttributeError):
5356
HTTPRequest(d)
5457

5558
def test_init_arg_exception_obj(self):
5659
class Tester(object):
57-
def __init__(self, endpoint="ok", bad_test="test"):
58-
self.endpoint = endpoint
60+
def __init__(self, resource="ok", bad_test="test"):
61+
self.resource = resource
5962
self.bad_test = bad_test
6063

6164
obj = Tester()
@@ -65,13 +68,11 @@ def __init__(self, endpoint="ok", bad_test="test"):
6568

6669
def test_init_partial(self):
6770
req = HTTPRequest(
68-
endpoint="endpoint test",
6971
method="method test",
7072
query_params={"test": "val"}
7173
)
7274
self.assertIsInstance(req, HTTPRequest)
7375

74-
self.assertEqual(req.endpoint, "endpoint test")
7576
self.assertEqual(req.method, "method test")
7677
self.assertEqual(req.query_params, {"test": "val"})
7778

@@ -86,7 +87,6 @@ def test_init_partial(self):
8687

8788
def test_init_all(self):
8889
req = HTTPRequest(
89-
endpoint="endpoint test",
9090
method="method test",
9191
resource="resource test",
9292
headers={"test": "val"},
@@ -96,7 +96,6 @@ def test_init_all(self):
9696
)
9797
self.assertIsInstance(req, HTTPRequest)
9898

99-
self.assertEqual(req.endpoint, "endpoint test")
10099
self.assertEqual(req.method, "method test")
101100
self.assertEqual(req.resource, "resource test")
102101
self.assertEqual(req.headers, {"test": "val"})
@@ -107,7 +106,6 @@ def test_init_all(self):
107106
def test_setters(self):
108107
req = HTTPRequest()
109108

110-
req.endpoint = "endpoint test"
111109
req.method = "method test"
112110
req.resource = "resource test"
113111
req.headers = {"test": "val"}
@@ -117,7 +115,6 @@ def test_setters(self):
117115

118116
self.assertIsInstance(req, HTTPRequest)
119117

120-
self.assertEqual(req.endpoint, "endpoint test")
121118
self.assertEqual(req.method, "method test")
122119
self.assertEqual(req.resource, "resource test")
123120
self.assertEqual(req.headers, {"test": "val"})
@@ -128,7 +125,6 @@ def test_setters(self):
128125
def test_setters_none(self):
129126
req = HTTPRequest()
130127

131-
req.endpoint = None
132128
req.method = None
133129
req.resource = None
134130
req.headers = None
@@ -138,9 +134,6 @@ def test_setters_none(self):
138134

139135
self.assertIsInstance(req, HTTPRequest)
140136

141-
self.assertTrue(hasattr(req, "endpoint"))
142-
self.assertIsNone(req.endpoint)
143-
144137
self.assertTrue(hasattr(req, "content"))
145138
self.assertIsNone(req.content)
146139

test/lrs_response_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
import unittest
1616
import httplib
17+
18+
if __name__ == '__main__':
19+
from main import setup_tincan_path
20+
setup_tincan_path()
1721
from tincan.lrs_response import LRSResponse
1822
from tincan.http_request import HTTPRequest
1923

test/main.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/env python
2-
31
# Copyright 2014 Rustici Software
42
#
53
# Licensed under the Apache License, Version 2.0 (the "License");

test/remote_lrs_test.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2014 Rustici Software
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
import unittest
216
import uuid
317
from datetime import datetime
@@ -260,7 +274,7 @@ def test_retrieve_statement(self):
260274
self.assertTrue(response.success)
261275
self._vars_verifier(response.content, statement, ['_authority', '_stored'])
262276

263-
def test_query_statements_UTC(self):
277+
def test_query_statements(self):
264278
tstamp = utc.localize(datetime.utcnow())
265279
s1 = Statement(
266280
actor=self.agent,
@@ -312,13 +326,14 @@ def test_query_statements_UTC(self):
312326

313327
def test_query_none(self):
314328
query = {
315-
"agent": Agent(mbox="unique@tincanapi.com"),
329+
"agent": self.agent,
316330
"verb": self.verb,
317331
"activity": self.parent,
318332
"related_activities": True,
319333
"related_agents": True,
320334
"format": "ids",
321-
"limit": 2
335+
"limit": 2,
336+
"registration": unicode(uuid.uuid4()),
322337
}
323338
response = self.lrs.query_statements(query)
324339

test/result_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/env python
2-
31
# Copyright 2014 Rustici Software
42
#
53
# Licensed under the Apache License, Version 2.0 (the "License");

test/score_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/env python
2-
31
# Copyright 2014 Rustici Software
42
#
53
# Licensed under the Apache License, Version 2.0 (the "License");

0 commit comments

Comments
 (0)