-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sunday Nwuguru
committed
May 20, 2016
1 parent
0e7b417
commit 8abe63b
Showing
8 changed files
with
111 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
!coverage.py: This is a private format, don't read it directly!{"lines": {"/Users/andela/Documents/projects/flaskapps/bucketlist-api/app/views.py": [1, 2, 3, 4, 6, 8, 9, 10, 11, 12, 13, 15, 16, 21], "/Users/andela/Documents/projects/flaskapps/bucketlist-api/test.py": [1, 3, 4], "/Users/andela/Documents/projects/flaskapps/bucketlist-api/app/resource.py": [1, 2, 3, 4, 5, 7, 9, 16, 17, 20, 22, 30, 31, 42, 43, 44, 47, 49, 60, 61, 62, 65, 68, 71, 73, 86, 87, 88, 89, 92, 94, 97, 100, 102, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 129, 132, 134, 147, 148, 149, 150, 153, 154, 155, 157, 160, 162, 184, 195, 196, 197, 200, 201, 204, 207, 209, 223, 224, 225, 226, 229, 230, 233, 234, 235, 237, 240, 243, 245, 259, 260, 261, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 275, 276, 277, 280, 283, 285, 298, 299, 300, 301, 304, 305, 308, 312, 313, 324, 325, 327, 330, 333, 335, 348, 349, 350, 353], "/Users/andela/Documents/projects/flaskapps/bucketlist-api/app/helper.py": [1, 2, 3, 4, 6, 8, 10, 11, 12, 13, 14, 15, 17, 19, 20, 21, 22, 27, 31, 32, 33, 37, 42, 43, 44, 45, 47, 49, 53, 55, 60, 61, 62, 66, 71, 72, 73], "/Users/andela/Documents/projects/flaskapps/bucketlist-api/test_config.py": [1, 2, 4, 6], "/Users/andela/Documents/projects/flaskapps/bucketlist-api/app/models.py": [1, 2, 3, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 18, 19, 20, 21, 22, 23, 24, 33, 34, 35, 36, 37, 38, 39, 40, 42, 43, 44, 46, 49, 50, 51, 52, 53, 54, 55, 56, 60, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 73, 76, 77, 78, 79, 80, 81, 82, 85, 86, 87], "/Users/andela/Documents/projects/flaskapps/bucketlist-api/production_config.py": [1, 2, 4, 6]}} | ||
!coverage.py: This is a private format, don't read it directly!{"lines": {"/Users/andela/Documents/projects/flaskapps/bucketlist-api/app/views.py": [1, 2, 3, 4, 6, 8, 9, 10, 11, 12, 13, 15, 16, 18, 21, 23], "/Users/andela/Documents/projects/flaskapps/bucketlist-api/test.py": [1, 3, 4], "/Users/andela/Documents/projects/flaskapps/bucketlist-api/app/resource.py": [1, 2, 3, 4, 5, 7, 9, 16, 17, 18, 20, 22, 28, 30, 31, 42, 43, 44, 45, 47, 49, 60, 61, 62, 63, 65, 66, 68, 71, 73, 86, 87, 88, 89, 90, 92, 94, 97, 100, 102, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 129, 132, 134, 147, 148, 149, 150, 153, 154, 155, 157, 160, 162, 173, 174, 175, 178, 179, 182, 184, 195, 196, 197, 198, 200, 201, 204, 207, 209, 223, 224, 225, 226, 227, 229, 230, 233, 234, 235, 237, 240, 243, 245, 259, 260, 261, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 275, 276, 277, 280, 283, 285, 298, 299, 300, 301, 302, 304, 305, 308, 312, 313, 324, 325, 327, 328, 330, 333, 335, 348, 349, 350, 351, 353], "/Users/andela/Documents/projects/flaskapps/bucketlist-api/app/helper.py": [1, 2, 3, 4, 6, 8, 10, 11, 12, 13, 14, 15, 17, 19, 20, 21, 22, 23, 24, 27, 31, 32, 33, 34, 35, 37, 42, 43, 44, 45, 47, 49, 53, 55, 60, 61, 62, 63, 64, 66, 71, 72, 73, 74, 75], "/Users/andela/Documents/projects/flaskapps/bucketlist-api/test_config.py": [1, 2, 4, 6], "/Users/andela/Documents/projects/flaskapps/bucketlist-api/app/models.py": [1, 2, 3, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 18, 19, 20, 21, 22, 23, 24, 27, 28, 31, 32, 33, 34, 35, 36, 37, 38, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 54, 55, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 71, 72, 74, 75, 76, 77, 78, 79, 80, 83, 84, 85], "/Users/andela/Documents/projects/flaskapps/bucketlist-api/production_config.py": [1, 2, 4, 6]}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
!coverage.py: This is a private format, don't read it directly!{"lines": {"/Library/Python/2.7/site-packages/nose/importer.py": [143, 144, 146, 147, 148, 149, 151, 152, 153, 154, 155, 156, 157, 158, 32, 161, 40, 41, 42, 44, 45, 47, 30, 54, 59, 62, 53, 65, 66, 67, 68, 70, 71, 72, 75, 76, 77, 78, 79, 80, 81, 94, 96, 97, 98, 63], "/Library/Python/2.7/site-packages/nose/loader.py": [128, 131, 179, 134, 135, 151, 143, 144, 145, 146, 147, 404, 149, 150, 89, 409, 154, 156, 90, 158, 159, 160, 161, 418, 91, 420, 421, 406, 424, 92, 170, 455, 178, 157, 177, 434, 435, 436, 181, 182, 183, 180, 186, 447, 416, 196, 197, 454, 481, 427, 201, 417, 79, 81, 82, 83, 84, 85, 86, 473, 474, 475, 476, 93, 94, 95, 97, 99, 422, 425, 209, 210, 369, 371, 410, 374, 375, 212, 378, 379, 200, 426, 405], "/Library/Python/2.7/site-packages/nose/plugins/isolate.py": [61, 62], "/Users/andela/Documents/projects/flaskapps/bucketlist-api/tests/test_bucketlists.py": [1, 2, 3, 4, 5], "/Library/Python/2.7/site-packages/nose/pyversion.py": [70, 175], "/Users/andela/Documents/projects/flaskapps/bucketlist-api/tests/test_bucketlists_items.py": [1, 2, 3, 4, 5], "/Library/Python/2.7/site-packages/nose/plugins/debug.py": [40, 41, 42, 43], "/Library/Python/2.7/site-packages/nose/suite.py": [539, 540, 543, 544, 545, 546, 547, 548, 551, 552, 554, 52, 53, 68, 72, 73, 75, 76, 79, 80, 81, 94, 95, 96, 97, 98, 99, 100, 103, 104, 105, 106, 107, 113, 114, 148, 149, 150, 151, 153, 154, 155, 156, 157, 158, 173, 177, 201, 204, 205, 208, 209, 216, 217, 218, 224, 226, 227, 228, 269, 270, 274, 277, 278, 279, 282, 283, 285, 286, 287, 288, 289, 290, 291, 292, 293, 297, 298, 301, 302, 303, 304, 308, 309, 310, 312, 313, 314, 315, 323, 324, 325, 326, 327, 328, 329, 330, 331, 337, 338, 339, 340, 341, 342, 345, 346, 347, 348, 349, 350, 351, 356, 357, 358, 360, 361, 362, 364, 365, 366, 367, 368, 372, 373, 374, 394, 396, 397, 401, 402, 403, 404, 405, 406, 407, 418, 419, 420, 421, 422, 423, 424, 427, 435, 436, 441, 443, 445, 446, 451, 452, 453, 454, 457, 459, 460, 462, 463, 464, 465, 466, 471, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486], "/Library/Python/2.7/site-packages/nose/plugins/doctests.py": [192, 193, 194, 195, 188, 189, 190, 191], "/Library/Python/2.7/site-packages/nose/plugins/failuredetail.py": [33, 35, 36], "/Library/Python/2.7/site-packages/nose/plugins/logcapture.py": [34, 38, 39, 40, 41, 44, 178, 179, 193, 194, 195, 196, 198, 199, 76, 204, 77, 78, 207, 80, 209, 86, 217, 79, 222, 208, 233, 234, 235, 240], "/Library/Python/2.7/site-packages/nose/result.py": [158, 159, 38, 39, 40, 41, 43, 44, 182, 183, 186, 187, 60, 61, 65, 69, 75, 76, 77, 81, 82, 88, 89, 90, 97, 98, 59, 103, 104, 105, 106, 109, 110], "/Library/Python/2.7/site-packages/nose/selector.py": [129, 130, 131, 134, 135, 35, 37, 40, 41, 42, 43, 44, 45, 53, 57, 244, 222, 224, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 116, 117, 118, 119, 123, 126, 127], "/Library/Python/2.7/site-packages/nose/plugins/deprecated.py": [40, 42, 43, 44], "/Library/Python/2.7/site-packages/nose/util.py": [320, 278, 263, 520, 521, 522, 267, 524, 526, 527, 272, 529, 530, 323, 660, 662, 663, 446, 312, 163, 164, 470, 321, 264, 306, 307, 308, 309, 310, 265, 184, 313, 266, 187, 188, 189, 190, 319, 192, 279, 322, 195, 471, 140, 311, 337, 338, 339, 340, 270, 342, 343, 271, 479, 481, 483, 484, 485, 486, 273, 449, 448, 318, 502, 503, 504, 276, 506, 447], "/Library/Python/2.7/site-packages/nose/plugins/prof.py": [71, 74, 75, 76, 80, 81, 82, 83, 84, 57], "/Library/Python/2.7/site-packages/nose/proxy.py": [128, 129, 130, 131, 132, 133, 30, 168, 169, 170, 43, 45, 46, 47, 176, 177, 178, 57, 58, 59, 60, 62, 64, 78, 80, 81, 82, 83, 89, 96, 102, 103, 104, 110, 111, 112, 116, 117, 118, 122, 123, 124, 125], "/Library/Python/2.7/site-packages/nose/plugins/testid.py": [137, 138, 142, 143, 144, 145, 148, 149, 150, 151, 154, 155], "/Library/Python/2.7/site-packages/nose/plugins/cover.py": [164, 263, 173, 271, 182, 183], "/Library/Python/2.7/site-packages/nose/plugins/skip.py": [57, 59, 60, 61], "/Library/Python/2.7/site-packages/nose/plugins/capture.py": [64, 96, 98, 69, 102, 97, 80, 74, 75, 76, 111, 112, 58, 59, 101], "/Library/Python/2.7/site-packages/nose/plugins/base.py": [98, 100, 101, 102], "/Library/Python/2.7/site-packages/nose/core.py": [65, 34, 36, 37, 41, 42, 43, 44, 50, 51, 55, 56, 59, 188, 61, 62, 193, 66, 199, 200, 201, 202, 203, 204, 205, 207, 187, 60], "/Library/Python/2.7/site-packages/nose/failure.py": [37, 38, 39, 22, 23, 24, 25, 26, 27, 30, 31], "/Users/andela/Documents/projects/flaskapps/bucketlist-api/tests/test_edge_cases.py": [1, 2, 3, 4, 5], "/Library/Python/2.7/site-packages/nose/plugins/manager.py": [128, 262, 263, 264, 265, 138, 139, 140, 141, 142, 143, 272, 273, 274, 149, 167, 134, 166, 295, 168, 301, 302, 125, 177, 178, 137, 184, 249, 88, 89, 93, 94, 95, 96, 144, 99, 252, 106, 107, 111, 114, 123, 118, 105, 120, 121, 250, 251, 124, 253, 254], "/Users/andela/Documents/projects/flaskapps/bucketlist-api/app/__init__.py": [1], "/Library/Python/2.7/site-packages/nose/plugins/xunit.py": [192, 193, 191], "/Library/Python/2.7/site-packages/nose/plugins/errorclass.py": [140, 141, 143, 144, 148, 150, 151, 152, 153, 154], "/Library/Python/2.7/site-packages/nose/plugins/multiprocess.py": [224, 225, 226, 227, 231, 233, 234, 235, 238, 223], "/Library/Python/2.7/site-packages/nose/case.py": [128, 129, 130, 131, 132, 133, 51, 140, 173, 147, 148, 149, 151, 154, 155, 29, 159, 160, 33, 34, 163, 36, 37, 38, 39, 40, 41, 42, 172, 45, 48, 49, 178, 179, 185, 59, 60, 64, 69, 70, 161, 74, 162, 99, 100, 101, 102, 103, 104, 167, 168, 166]}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import unittest | ||
import json | ||
from os import sys, path | ||
sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) | ||
from app import app, db | ||
from app.models import * | ||
from app.helper import * | ||
|
||
|
||
class TestResources(unittest.TestCase): | ||
"""Test cases for Bucketlist Items""" | ||
|
||
def setUp(self): | ||
app.config.from_object('test_config') | ||
self.app = app.test_client() | ||
self.uid = 0 | ||
self.token = '' | ||
self.bucketlist_id = 0 | ||
self.bucketlist_item_id = 0 | ||
|
||
def test_helper_delete_exception(self): | ||
bucketlist = BucketListModel('unknown', None) | ||
self.assertEqual(delete(bucketlist), False) | ||
|
||
def test_helper_get_user_id_from_token_exception(self): | ||
self.assertEqual(get_user_id_from_token('bucketlist'), 0) | ||
|
||
def test_helper_encrypt_exception(self): | ||
self.assertEqual(encrypt(False), False) | ||
|
||
def test_helper_decrypt_exception(self): | ||
self.assertEqual(decrypt(False), False) | ||
|
||
def test_model_repr(self): | ||
user = User('guru','','') | ||
bucketlist = BucketListModel('test', user) | ||
bucketlist_item = BucketListItemModel('test', bucketlist) | ||
print user, bucketlist, bucketlist_item | ||
|
||
def test_view_index(self): | ||
response = self.app.get('/') | ||
self.assertEqual(response.status_code, 200) | ||
|
||
def test_view_not_found(self): | ||
response = self.app.get('/unknown') | ||
self.assertEqual(response.status_code, 404) | ||
|
||
def test_resource_no_token(self): | ||
response = self.app.get('/api/v1.0/bucketlists') | ||
self.assertEqual(response.status_code, 403) | ||
|
||
|
||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |