Skip to content

Commit

Permalink
fix test_api
Browse files Browse the repository at this point in the history
  • Loading branch information
sebestajozef committed Mar 3, 2016
1 parent a4da5d3 commit c31b265
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion account/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import PermissionsMixin
from django.contrib.auth.base_user import BaseUserManager, AbstractBaseUser

from .signals import *

class UserManager(BaseUserManager):

Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion nostromo/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from nostromo.models import DataSet
from nostromo.serializers import DatasetSerializer
import json

logger = logging.getLogger("api")

Expand All @@ -21,7 +22,8 @@ def create(self, request, *args, **kwargs):

processed = 0
success = 0
for data in request.data:
converted_data = json.loads(request.data)
for data in converted_data:
start_date = datetime.utcfromtimestamp(data['start']/1000)
end_date = datetime.utcfromtimestamp(data['end']/1000)
data_type = data["type"]
Expand Down
14 changes: 7 additions & 7 deletions nostromo/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class ApiTestCase(TestCase):

def setUp(self):
self.user_tom = User.objects.create(first_name='tom', last_name='cruise')
self.user_tom = User.objects.create_user(first_name='tom', last_name='cruise',email='[email protected]')
self.client = APIClient()
self.client.credentials(HTTP_AUTHORIZATION='Token ' + self.user_tom.auth_token.key)
matrix1 = [
Expand Down Expand Up @@ -65,8 +65,8 @@ def setUp(self):

def testTryToSaveAllDuplicates(self):
data = [{
"start": 1455828579707,
"end": 1455828698961,
"start": 1455828698961,
"end": 1455828579707,
"type": "accel",
"data": [
[-0.02, -0.046, -1.004],
Expand All @@ -81,8 +81,8 @@ def testTryToSaveAllDuplicates(self):
[-0.018, -0.046, -1.005]
]
}, {
"start": 1455828579709,
"end": 1455828698964,
"start": 1455828698964,
"end": 1455828579709,
"type": "accel",
"data": [
[-0.01, -0.046, -1.004],
Expand Down Expand Up @@ -141,8 +141,8 @@ def testTryToSaveAllCorrect(self):

def testTryToSaveSomeDuplicate(self):
data = [{
"start": 1455828579707,
"end": 1455828698961,
"start": 1455828698961,
"end": 1455828579707,
"type": "accel",
"data": [
[-0.02, -0.046, -1.004],
Expand Down

0 comments on commit c31b265

Please sign in to comment.