-
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.
storing data in the database of pushlog info
- Loading branch information
AutomatedTester
committed
Jun 3, 2013
1 parent
53a2a46
commit d945522
Showing
3 changed files
with
42 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{"28834": {"branch_name": "Mozilla-Inbound", "revisions": ["71cd8f642cfa"]}, "28835": {"branch_name": "Mozilla-Inbound", | ||
"revisions": ["b5b3993fd079"]}, "28836": {"branch_name": "Mozilla-Inbound", "revisions": ["b8122753e0b3", | ||
"121b620c7e49"]}} |
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,22 @@ | ||
import os | ||
import json | ||
|
||
|
||
import test_utils | ||
import bisectcloud.site.tasks as task | ||
from bisectcloud.site.models import * | ||
|
||
class TaskTests(test_utils.TestCase): | ||
|
||
def test_we_can_call_tasks(self): | ||
pass | ||
|
||
def test_we_can_store_json_blob_in_datastore(self): | ||
with open(os.path.join(os.path.dirname(__file__),'pushlog.json'), 'r') as f: | ||
jsonblob = f.read() | ||
|
||
task._store_pushlog_in_datastore(json.loads(jsonblob)) | ||
|
||
self.assertEqual(4, len(Revisions.objects.all())) | ||
self.assertEqual(3, len(Pushlog.objects.all())) | ||
|
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,17 @@ | ||
import requests | ||
from models import Pushlog, Revisions | ||
|
||
def get_pushlog(): | ||
pass | ||
|
||
def _store_pushlog_in_datastore(push_json): | ||
for k, v in push_json.items(): | ||
pushlog = Pushlog(push_id = k, | ||
branch_name=push_json[k]['branch_name']) | ||
pushlog.save() | ||
for revision in push_json[k]['revisions']: | ||
revisions = Revisions(revisions=revision, | ||
pushlog=pushlog) | ||
revisions.save() | ||
|
||
|