Skip to content

Commit

Permalink
clean up properties/attributes for mock classes
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeddy committed Jul 9, 2019
1 parent 650a615 commit 90d9220
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
9 changes: 5 additions & 4 deletions synprov/mockup_data/activity.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import uuid
import json


from synprov.models.activity import Activity
from synprov.mockup_data.dict import ActivityClasses
from synprov.util import get_datetime


class MockActivity(Activity):
Expand All @@ -11,8 +13,9 @@ class MockActivity(Activity):

def __init__(self, name='', class_idx=0):
super().__init__(name=name)
self.id = uuid.uuid1()
self.id = str(uuid.uuid1())
self._class = self.activity_classes[class_idx]
self.created_at = get_datetime()
self.label = 'Activity'
self.openapi_types.update({'label': str})

Expand All @@ -23,6 +26,4 @@ def get_class_count(self):
return len(self.activity_classes)

def get_data(self):
x = self.to_dict()
x.update({':LABEL': self.label})
return x
return self.to_dict()
8 changes: 4 additions & 4 deletions synprov/mockup_data/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
import json

from synprov.models.agent import Agent
from synprov.util import get_datetime


class MockAgent(Agent):

def __init__(self, name='', user_id=''):
super().__init__(name=name, user_id=user_id)
self.id = uuid.uuid1()
self.id = str(uuid.uuid1())
self.created_at = get_datetime()
self.label = 'Agent'
self.openapi_types.update({'label': str})

def get_data(self):
x = self.to_dict()
x.update({':LABEL': self.label})
return x
return self.to_dict()
8 changes: 4 additions & 4 deletions synprov/mockup_data/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from synprov.models.reference import Reference
from synprov.mockup_data.dict import ReferenceClasses
from synprov.mockup_data.dict import ReferenceSubclasses
from synprov.util import get_datetime


class MockReference(Reference):
Expand All @@ -20,7 +21,8 @@ def __init__(self,
super().__init__(name=name,
target_id=target_id,
target_version_id=target_version_id)
self.id = uuid.uuid1()
self.id = str(uuid.uuid1())
self.created_at = get_datetime()
self.label = 'Reference'
self.openapi_types.update({'label': str})

Expand All @@ -37,6 +39,4 @@ def get_subclass_count(self):
return len(self.reference_subclasses[self._class])

def get_data(self):
x = self.to_dict()
x.update({':LABEL': self.label})
return x
return self.to_dict()
13 changes: 5 additions & 8 deletions synprov/mockup_data/relationship.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from synprov.models.prov_relationship import ProvRelationship
from synprov.mockup_data.dict import (ActivityRoles,
NodeRelationships)
from synprov.util import get_datetime


class MockRelationship(ProvRelationship):
Expand All @@ -13,7 +14,8 @@ class MockRelationship(ProvRelationship):

def __init__(self, start_node, end_node, activity_class=None):
super().__init__(start_node=start_node.id, end_node=end_node.id)

self.id = str(uuid.uuid1())
self.created_at = get_datetime()
self.start_id = start_node
self.end_id = end_node

Expand Down Expand Up @@ -41,10 +43,5 @@ def __init__(self, start_node, end_node, activity_class=None):
][self.type][start_node.subclass]['role']

def get_data(self):
x = self.to_dict()
x.update({
':START_ID': str(self.start_id),
':END_ID': str(self.end_id),
':TYPE': self.type
})
return x
return self.to_dict()

0 comments on commit 90d9220

Please sign in to comment.