Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
common_helper_mongo
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-gitdep
common_helper_mongo
Commits
9c2e9bdc
Commit
9c2e9bdc
authored
8 years ago
by
Peter Weidenbach
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring and requirements added
parent
b2c27bf9
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
9 deletions
+24
-9
requirements.txt
requirements.txt
+1
-0
setup.py
setup.py
+4
-0
base_class_database_test.py
tests/base_class_database_test.py
+16
-0
test_gridfs.py
tests/test_gridfs.py
+3
-9
No files found.
requirements.txt
0 → 100644
View file @
9c2e9bdc
pymongo
>= 3.2
This diff is collapsed.
Click to expand it.
setup.py
View file @
9c2e9bdc
...
...
@@ -6,4 +6,8 @@ setup(
name
=
"common_helper_mongo"
,
version
=
subprocess
.
check_output
([
'git'
,
'describe'
,
'--always'
],
cwd
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))
.
strip
()
.
decode
(
'utf-8'
),
packages
=
find_packages
(),
install_requires
=
[
'pymongo >= 3.2'
],
description
=
"MongoDB helper functions"
)
This diff is collapsed.
Click to expand it.
tests/base_class_database_test.py
0 → 100644
View file @
9c2e9bdc
import
unittest
from
pymongo
import
MongoClient
class
MongoDbTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
mongo_client
=
MongoClient
()
self
.
db
=
self
.
mongo_client
[
"common_code_test"
]
def
tearDown
(
self
):
self
.
mongo_client
.
drop_database
(
self
.
db
)
self
.
mongo_client
.
close
()
if
__name__
==
"__main__"
:
unittest
.
main
()
This diff is collapsed.
Click to expand it.
tests/test_gridfs.py
View file @
9c2e9bdc
import
unittest
from
pymongo
import
MongoClient
import
gridfs
from
common_helper_mongo.gridfs
import
overwrite_file
from
tests.base_class_database_test
import
MongoDbTest
class
TestGridFS
(
unittest
.
TestCase
):
class
TestGridFS
(
MongoDbTest
):
def
setUp
(
self
):
self
.
mongo_client
=
MongoClient
()
self
.
db
=
self
.
mongo_client
[
"common_code_test"
]
super
()
.
setUp
()
self
.
fs
=
gridfs
.
GridFS
(
self
.
db
)
def
tearDown
(
self
):
self
.
mongo_client
.
drop_database
(
self
.
db
)
self
.
mongo_client
.
close
()
def
testOverwriteFile
(
self
):
self
.
fs
.
put
(
b
'original'
,
filename
=
"test_file"
)
original_content
=
self
.
fs
.
find_one
({
'filename'
:
"test_file"
})
.
read
()
...
...
@@ -27,5 +22,4 @@ class TestGridFS(unittest.TestCase):
if
__name__
==
"__main__"
:
# import sys;sys.argv = ['', 'Test.testName']
unittest
.
main
()
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment