|
1 | 1 | from eve.tests import TestMinimal
|
2 | 2 | import os
|
3 |
| -import re |
4 | 3 | from flask_pymongo import MongoClient
|
5 | 4 |
|
6 | 5 | url = 'mriqc_api'
|
7 | 6 | MONGO_HOST = os.environ.get("MONGODB_HOST", 'mongodb'),
|
8 | 7 | MONGO_PORT = int(os.environ.get("MONGODB_PORT", 27017))
|
9 | 8 | MONGO_DBNAME = 'test_DB'
|
| 9 | + |
| 10 | + |
10 | 11 | class settingsTestCase(TestMinimal):
|
11 |
| - def setUp(self): |
12 |
| - return super().setUp(settings_file = './settings.py') |
13 |
| - def dropDB(self): |
14 |
| - self.connection = MongoClient(MONGO_HOST,MONGO_PORT) |
15 |
| - self.connection.drop_database(MONGO_DBNAME) |
16 |
| - self.connection.close() |
17 |
| - def setupDB(self): |
18 |
| - self.connection = MongoClient(MONGO_HOST,MONGO_PORT) |
19 |
| - self.connection.drop_database(MONGO_DBNAME) |
20 |
| - def testGet(self): |
21 |
| - return_json,return_code = self.get(url) |
22 |
| - self.assert200(return_code) |
23 |
| - def testPost(self): |
24 |
| - return_json, return_code = self.post(url, {"cjv": 0.1231231}) |
25 |
| - self.assertFalse(self.domain) |
26 |
| - self.assertFalse(return_json) |
27 |
| - # self.assert200(return_code) |
28 |
| - |
29 |
| -# class settingsTestCase(TestMinimal): |
30 |
| -# def dropDB(self): |
31 |
| -# self.connection = MongoClient(MONGO_HOST, MONGO_PORT) |
32 |
| -# self.connection.drop_database(MONGO_DBNAME) |
33 |
| -# self.connection.close() |
| 12 | + def setUp(self): |
| 13 | + return super().setUp(settings_file='./settings.py') |
34 | 14 |
|
35 |
| -# def setupDB(self): |
36 |
| -# self.connection = MongoClient(MONGO_HOST, MONGO_PORT) |
37 |
| -# self.connection.drop_database(MONGO_DBNAME) |
38 |
| -# def testPost(): |
39 |
| -# return_json, return_code = self.post(url,{"cjg":0.123123}) |
40 |
| -# print(return_json) |
41 |
| -# print(return_code) |
| 15 | + def dropDB(self): |
| 16 | + self.connection = MongoClient(MONGO_HOST, MONGO_PORT) |
| 17 | + self.connection.drop_database(MONGO_DBNAME) |
| 18 | + self.connection.close() |
42 | 19 |
|
| 20 | + def setupDB(self): |
| 21 | + self.connection = MongoClient(MONGO_HOST, MONGO_PORT) |
| 22 | + self.connection.drop_database(MONGO_DBNAME) |
43 | 23 |
|
| 24 | + def testGet(self): |
| 25 | + return_json, return_code = self.get(url) |
| 26 | + self.assert200(return_code) |
44 | 27 |
|
| 28 | + def testPost(self): |
| 29 | + return_json, return_code = self.post(url, {"cjv": 0.1231231}) |
| 30 | + self.assertFalse(self.domain) |
| 31 | + self.assertFalse(return_json) |
| 32 | + # self.assert200(return_code) |
| 33 | + |
| 34 | +# class settingsTestCase(TestMinimal): |
| 35 | +# def dropDB(self): |
| 36 | +# self.connection = MongoClient(MONGO_HOST, MONGO_PORT) |
| 37 | +# self.connection.drop_database(MONGO_DBNAME) |
| 38 | +# self.connection.close() |
45 | 39 |
|
| 40 | +# def setupDB(self): |
| 41 | +# self.connection = MongoClient(MONGO_HOST, MONGO_PORT) |
| 42 | +# self.connection.drop_database(MONGO_DBNAME) |
| 43 | +# def testPost(): |
| 44 | +# return_json, return_code = self.post(url,{"cjg":0.123123}) |
| 45 | +# print(return_json) |
| 46 | +# print(return_code) |
0 commit comments