def setUp(self): "Initial Setup" if not self.prepared: self.group, created = Group.objects.get_or_create(name='test') duser, created = DjangoUser.objects.get_or_create(username=self.username) duser.set_password(self.password) duser.save() self.user, created = User.objects.get_or_create(user=duser) self.user.save() perspective, created = Perspective.objects.get_or_create(name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.contact_type = ContactType(name='test') self.contact_type.set_default_user() self.contact_type.save() self.contact = Contact(name='test', contact_type=self.contact_type) self.contact.set_default_user() self.contact.save() self.stream = MessageStream(name='test') self.stream.set_default_user() self.stream.save() self.message = Message(title='test', body='test', author=self.contact, stream=self.stream) self.message.set_default_user() self.message.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: # Clean up first Object.objects.all().delete() # Create objects self.group, created = Group.objects.get_or_create(name='test') duser, created = DjangoUser.objects.get_or_create(username=self.username) duser.set_password(self.password) duser.save() self.user, created = User.objects.get_or_create(user=duser) self.user.save() perspective, created = Perspective.objects.get_or_create(name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.contact_type = ContactType(name='Person') self.contact_type.set_default_user() self.contact_type.save() self.contact = Contact(name='Test', contact_type=self.contact_type) self.contact.set_default_user() self.contact.save() self.field = ContactField(name='Test', label='test', field_type='text') self.field.set_default_user() self.field.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: self.group, created = Group.objects.get_or_create(name='test') duser, created = DjangoUser.objects.get_or_create( username=self.username) duser.set_password(self.password) duser.save() self.user, created = User.objects.get_or_create(user=duser) self.user.save() perspective, created = Perspective.objects.get_or_create( name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.report = Report(name='test') self.report.set_default_user() self.report.save() self.chart = Chart(name='test_chart', report=self.report) self.chart.set_default_user() self.chart.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: Object.objects.all().delete() # Create objects try: self.group = Group.objects.get(name='test') except Group.DoesNotExist: Group.objects.all().delete() self.group = Group(name='test') self.group.save() try: self.user = DjangoUser.objects.get(username=self.username) self.user.set_password(self.password) try: self.profile = self.user.get_profile() except Exception: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() except DjangoUser.DoesNotExist: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() try: perspective = Perspective.objects.get(name='default') except Perspective.DoesNotExist: Perspective.objects.all().delete() perspective = Perspective(name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.folder = Folder(name='test') self.folder.set_default_user() self.folder.save() self.document = Document(title='test_document', folder=self.folder) self.document.set_default_user() self.document.save() self.file = File(name='test_file', folder=self.folder) self.file.set_default_user() self.file.save() self.link = WebLink(title='test', folder=self.folder, url='test') self.link.set_default_user() self.link.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: # Clean up first Object.objects.all().delete() # Create objects try: self.group = Group.objects.get(name='test') except Group.DoesNotExist: Group.objects.all().delete() self.group = Group(name='test') self.group.save() try: self.user = DjangoUser.objects.get(username=self.username) self.user.set_password(self.password) try: self.profile = self.user.get_profile() except Exception: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() except DjangoUser.DoesNotExist: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() try: perspective = Perspective.objects.get(name='default') except Perspective.DoesNotExist: Perspective.objects.all().delete() perspective = Perspective(name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.contact_type = ContactType(name='test') self.contact_type.set_default_user() self.contact_type.save() self.contact = Contact(name='test', contact_type=self.contact_type) self.contact.set_default_user() self.contact.save() self.stream = MessageStream(name='test') self.stream.set_default_user() self.stream.save() self.message = Message(title='test', body='test', author=self.contact, stream=self.stream) self.message.set_default_user() self.message.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: Object.objects.all().delete() # Create objects self.group, created = Group.objects.get_or_create(name='test') duser, created = DjangoUser.objects.get_or_create(username=self.username) duser.set_password(self.password) duser.save() self.user, created = User.objects.get_or_create(user=duser) self.user.save() perspective, created = Perspective.objects.get_or_create(name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.perspective = Perspective(name='test') self.perspective.set_default_user() self.perspective.save() self.group = Group(name='test') self.group.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: # Clean up first Object.objects.all().delete() # Create objects try: self.group = Group.objects.get(name='test') except Group.DoesNotExist: Group.objects.all().delete() self.group = Group(name='test') self.group.save() try: self.user = DjangoUser.objects.get(username=self.username) self.user.set_password(self.password) try: self.profile = self.user.get_profile() except Exception: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() except DjangoUser.DoesNotExist: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() try: perspective = Perspective.objects.get(name='default') except Perspective.DoesNotExist: Perspective.objects.all().delete() perspective = Perspective(name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.folder = KnowledgeFolder(name='test', treepath='test') self.folder.set_default_user() self.folder.save() self.category = KnowledgeCategory(name='test', treepath='test') self.category.set_default_user() self.category.save() self.item = KnowledgeItem(name='test', folder=self.folder, category=self.category, treepath='test') self.item.set_default_user() self.item.save() # parent folder self.parent = KnowledgeFolder(name='test', treepath='test') self.parent.set_default_user() self.parent.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: # Clean up first Object.objects.all().delete() # Create objects self.group, created = Group.objects.get_or_create(name='test') duser, created = DjangoUser.objects.get_or_create( username=self.username) duser.set_password(self.password) duser.save() self.user, created = User.objects.get_or_create(user=duser) self.user.save() perspective, created = Perspective.objects.get_or_create( name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.event = Event(name='TestStatus', end=datetime.now()) self.event.set_default_user() self.event.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: self.group, created = Group.objects.get_or_create(name='test') duser, created = DjangoUser.objects.get_or_create(username=self.username) duser.set_password(self.password) duser.save() self.user, created = User.objects.get_or_create(user=duser) self.user.save() perspective, created = Perspective.objects.get_or_create(name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.report = Report(name='test') self.report.set_default_user() self.report.save() self.chart = Chart(name='test_chart', report=self.report) self.chart.set_default_user() self.chart.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: self.group, created = Group.objects.get_or_create(name='test') duser, created = DjangoUser.objects.get_or_create(username=self.username) duser.set_password(self.password) duser.save() self.user, created = User.objects.get_or_create(user=duser) self.user.save() perspective, created = Perspective.objects.get_or_create(name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.folder = KnowledgeFolder(name='test', treepath='test') self.folder.set_default_user() self.folder.save() self.category = KnowledgeCategory(name='test', treepath='test') self.category.set_default_user() self.category.save() self.item = KnowledgeItem(name='test', folder=self.folder, category=self.category, treepath='test') self.item.set_default_user() self.item.save() # parent folder self.parent = KnowledgeFolder(name='test', treepath='test') self.parent.set_default_user() self.parent.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: Object.objects.all().delete() # Create objects self.group, created = Group.objects.get_or_create(name='test') duser, created = DjangoUser.objects.get_or_create( username=self.username) duser.set_password(self.password) duser.save() self.user, created = User.objects.get_or_create(user=duser) self.user.save() perspective, created = Perspective.objects.get_or_create( name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.perspective = Perspective(name='test') self.perspective.set_default_user() self.perspective.save() self.group = Group(name='test') self.group.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: # Clean up first Object.objects.all().delete() User.objects.all().delete() # Create objects self.group, created = Group.objects.get_or_create(name='test') duser, created = DjangoUser.objects.get_or_create(username=self.username) duser.set_password(self.password) duser.save() self.user, created = User.objects.get_or_create(user=duser) self.user.save() perspective, created = Perspective.objects.get_or_create(name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.contact_type = ContactType(name='test') self.contact_type.set_default_user() self.contact_type.save() self.contact = Contact(name='test', contact_type=self.contact_type) self.contact.set_default_user() self.contact.save() self.status = TicketStatus(name='TestStatus') self.status.set_default_user() self.status.save() self.queue = TicketQueue(name='TestQueue', default_ticket_status=self.status) self.queue.set_default_user() self.queue.save() self.ticket = Ticket(name='TestTicket', status=self.status, queue=self.queue) self.ticket.set_default_user() self.ticket.save() self.agent = ServiceAgent(related_user=self.user, available_from=datetime.time(9), available_to=datetime.time(17)) self.agent.set_default_user() self.agent.save() self.service = Service(name='test') self.service.set_default_user() self.service.save() self.sla = ServiceLevelAgreement(name='test', service=self.service, client=self.contact, provider=self.contact) self.sla.set_default_user() self.sla.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: # Clean up first Object.objects.all().delete() # Create objects try: self.group = Group.objects.get(name='test') except Group.DoesNotExist: Group.objects.all().delete() self.group = Group(name='test') self.group.save() try: self.user = DjangoUser.objects.get(username=self.username) self.user.set_password(self.password) try: self.profile = self.user.get_profile() except Exception: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() except DjangoUser.DoesNotExist: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() try: perspective = Perspective.objects.get(name='default') except Perspective.DoesNotExist: Perspective.objects.all().delete() perspective = Perspective(name='default') perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.contact_type = ContactType(name='Person') self.contact_type.set_default_user() self.contact_type.save() self.contact = Contact(name='Test', contact_type=self.contact_type) self.contact.set_default_user() self.contact.save() self.field = ContactField(name='Test', label='test', field_type='text') self.field.set_default_user() self.field.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: Object.objects.all().delete() # Create objects try: self.group = Group.objects.get(name='test') except Group.DoesNotExist: Group.objects.all().delete() self.group = Group(name='test') self.group.save() try: self.user = DjangoUser.objects.get(username=self.username) self.user.set_password(self.password) try: self.profile = self.user.get_profile() except Exception: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() except DjangoUser.DoesNotExist: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() try: perspective = Perspective.objects.get(name='default') except Perspective.DoesNotExist: Perspective.objects.all().delete() perspective = Perspective(name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.report = Report(name='test') self.report.set_default_user() self.report.save() self.chart = Chart(name='test_chart', report=self.report) self.chart.set_default_user() self.chart.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: # Clean up first Object.objects.all().delete() # Create objects try: self.group = Group.objects.get(name='test') except Group.DoesNotExist: Group.objects.all().delete() self.group = Group(name='test') self.group.save() try: self.user = DjangoUser.objects.get(username=self.username) self.user.set_password(self.password) try: self.profile = self.user.get_profile() except Exception: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() except DjangoUser.DoesNotExist: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() try: perspective = Perspective.objects.get(name='default') except Perspective.DoesNotExist: Perspective.objects.all().delete() perspective = Perspective(name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.event = Event(name='TestStatus', end=datetime.now()) self.event.set_default_user() self.event.save() self.client = Client() self.prepared = True
def profile_check(request): "If nuvius_id within GET parameters of the request, store the ID within Django session" nuvius_id = request.GET.get('nuvius_id', None) if nuvius_id: nuvius_key = request.GET.get('profile_key', None) if nuvius_key: con = Connector(profile_id=nuvius_id, profile_key=nuvius_key) profile = con.get_profile() try: if profile['key_valid']: request.session['nuvius_id'] = nuvius_id request.session['nuvius_profile_key'] = nuvius_key except KeyError: pass else: request.session['nuvius_id'] = nuvius_id response = HttpResponse(json.dumps(profile), mimetype='application/json') # Hardtree code if 'applications' in profile: del profile['applications'] if 'bindings' in profile: del profile['bindings'] user = request.user.get_profile() conf = ModuleSetting.set('nuvius_profile', '', user=user) conf.dumps(profile).save() # End of Hardtree code return response
def setUp(self): "Initial Setup" if not self.prepared: self.group, created = Group.objects.get_or_create(name='test') duser, created = DjangoUser.objects.get_or_create( username=self.username) duser.set_password(self.password) duser.save() self.user, created = User.objects.get_or_create(user=duser) self.user.save() perspective, created = Perspective.objects.get_or_create( name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.type = ItemType(name='test') self.type.set_default_user() self.type.save() self.status = ItemStatus(name='test') self.status.set_default_user() self.status.save() self.field = ItemField(name='test', label='test', field_type='text') self.field.set_default_user() self.field.save() self.item = Item(name='test', item_type=self.type, status=self.status) self.item.set_default_user() self.item.save() self.value = ItemValue(field=self.field, item=self.item) self.value.save() self.servicing = ItemServicing(name='test') self.servicing.set_default_user() self.servicing.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: self.group, created = Group.objects.get_or_create(name='test') duser, created = DjangoUser.objects.get_or_create( username=self.username) duser.set_password(self.password) duser.save() self.user, created = User.objects.get_or_create(user=duser) self.user.save() perspective, created = Perspective.objects.get_or_create( name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.type = ItemType(name='test') self.type.set_default_user() self.type.save() self.status = ItemStatus(name='test') self.status.set_default_user() self.status.save() self.field = ItemField( name='test', label='test', field_type='text') self.field.set_default_user() self.field.save() self.item = Item( name='test', item_type=self.type, status=self.status) self.item.set_default_user() self.item.save() self.value = ItemValue(field=self.field, item=self.item) self.value.save() self.servicing = ItemServicing(name='test') self.servicing.set_default_user() self.servicing.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: Object.objects.all().delete() # Create objects self.group, created = Group.objects.get_or_create(name='test') duser, created = DjangoUser.objects.get_or_create( username=self.username) duser.set_password(self.password) duser.save() self.user, created = User.objects.get_or_create(user=duser) self.user.save() perspective, created = Perspective.objects.get_or_create( name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.folder = Folder(name='test') self.folder.set_default_user() self.folder.save() self.document = Document(title='test_document', folder=self.folder) self.document.set_default_user() self.document.save() self.file = File(name='test_file', folder=self.folder) self.file.set_default_user() self.file.save() self.link = WebLink(title='test', folder=self.folder, url='test') self.link.set_default_user() self.link.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: self.group, created = Group.objects.get_or_create(name='test') duser, created = DjangoUser.objects.get_or_create( username=self.username) duser.set_password(self.password) duser.save() self.user, created = User.objects.get_or_create(user=duser) self.user.save() perspective, created = Perspective.objects.get_or_create( name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.folder = KnowledgeFolder(name='test', treepath='test') self.folder.set_default_user() self.folder.save() self.category = KnowledgeCategory(name='test', treepath='test') self.category.set_default_user() self.category.save() self.item = KnowledgeItem(name='test', folder=self.folder, category=self.category, treepath='test') self.item.set_default_user() self.item.save() # parent folder self.parent = KnowledgeFolder(name='test', treepath='test') self.parent.set_default_user() self.parent.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: self.group, created = Group.objects.get_or_create(name='test') duser, created = DjangoUser.objects.get_or_create( username=self.username) duser.set_password(self.password) duser.save() self.user, created = User.objects.get_or_create(user=duser) self.user.save() perspective, created = Perspective.objects.get_or_create( name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.contact_type = ContactType(name='test') self.contact_type.set_default_user() self.contact_type.save() self.contact = Contact(name='test', contact_type=self.contact_type) self.contact.set_default_user() self.contact.save() self.stream = MessageStream(name='test') self.stream.set_default_user() self.stream.save() self.message = Message(title='test', body='test', author=self.contact, stream=self.stream) self.message.set_default_user() self.message.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: # Clean up first Object.objects.all().delete() # Create objects self.group, created = Group.objects.get_or_create(name='test') duser, created = DjangoUser.objects.get_or_create( username=self.username) duser.set_password(self.password) duser.save() self.user, created = User.objects.get_or_create(user=duser) self.user.save() perspective, created = Perspective.objects.get_or_create( name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.contact_type = ContactType(name='Person') self.contact_type.set_default_user() self.contact_type.save() self.contact = Contact(name='Test', contact_type=self.contact_type) self.contact.set_default_user() self.contact.save() self.field = ContactField(name='Test', label='test', field_type='text') self.field.set_default_user() self.field.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: # Clean up first Object.objects.all().delete() User.objects.all().delete() # Create objects try: self.group = Group.objects.get(name='api_test') except Group.DoesNotExist: Group.objects.all().delete() self.group = Group(name='api_test') self.group.save() try: self.user = DjangoUser.objects.get(username=self.username) self.user.set_password(self.password) try: self.profile = self.user.get_profile() except Exception: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() except DjangoUser.DoesNotExist: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() try: perspective = Perspective.objects.get(name='default') except Perspective.DoesNotExist: Perspective.objects.all().delete() perspective = Perspective(name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.contact_type = ContactType(name='api_test') self.contact_type.set_default_user() self.contact_type.save() self.contact = Contact( name='api_test', contact_type=self.contact_type) self.contact.set_default_user() self.contact.save() self.project = Project( name='api_test', manager=self.contact, client=self.contact) self.project.set_default_user() self.project.save() self.status = TaskStatus(name='api_test') self.status.set_default_user() self.status.save() self.milestone = Milestone( name='api_test', project=self.project, status=self.status) self.milestone.set_default_user() self.milestone.save() self.task = Task( name='api_test', project=self.project, status=self.status, priority=3) self.task.set_default_user() self.task.save() self.time_slot = TaskTimeSlot( task=self.task, details='api_test', time_from=datetime.now(), user=self.user.get_profile()) self.time_slot.set_default_user() self.time_slot.save() self.parent = Project(name='api_test') self.parent.set_default_user() self.parent.save() self.parent_task = Task( name='api_test', project=self.project, status=self.status, priority=3) self.parent_task.set_default_user() self.parent_task.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: # Clean up first Object.objects.all().delete() User.objects.all().delete() # Create objects self.group, created = Group.objects.get_or_create(name="test") duser, created = DjangoUser.objects.get_or_create(username=self.username) duser.set_password(self.password) duser.save() self.user, created = User.objects.get_or_create(user=duser) self.user.save() perspective, created = Perspective.objects.get_or_create(name="default") perspective.set_default_user() perspective.save() ModuleSetting.set("default_perspective", perspective.id) self.contact_type = ContactType(name="test") self.contact_type.set_default_user() self.contact_type.save() self.contact = Contact(name="test", contact_type=self.contact_type) self.contact.set_default_user() self.contact.save() self.project = Project(name="test", manager=self.contact, client=self.contact) self.project.set_default_user() self.project.save() self.status = TaskStatus(name="test") self.status.set_default_user() self.status.save() self.milestone = Milestone(name="test", project=self.project, status=self.status) self.milestone.set_default_user() self.milestone.save() self.task = Task(name="test", project=self.project, status=self.status, priority=3) self.task.set_default_user() self.task.save() self.time_slot = TaskTimeSlot(task=self.task, details="test", time_from=datetime.now(), user=self.user) self.time_slot.set_default_user() self.time_slot.save() self.parent = Project(name="test") self.parent.set_default_user() self.parent.save() self.parent_task = Task(name="test", project=self.project, status=self.status, priority=3) self.parent_task.set_default_user() self.parent_task.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: # Clean up first Object.objects.all().delete() User.objects.all().delete() # Create objects try: self.group = Group.objects.get(name='test') except Group.DoesNotExist: Group.objects.all().delete() self.group = Group(name='test') self.group.save() try: self.user = DjangoUser.objects.get(username=self.username) self.user.set_password(self.password) try: self.profile = self.user.get_profile() except Exception: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() except DjangoUser.DoesNotExist: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() try: perspective = Perspective.objects.get(name='default') except Perspective.DoesNotExist: Perspective.objects.all().delete() perspective = Perspective(name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.contact_type = ContactType() self.contact_type.slug = 'machine' self.contact_type.name = 'machine' self.contact_type.save() self.contact = Contact() self.contact.contact_type = self.contact_type self.contact.set_default_user() self.contact.save() self.assertNotEquals(self.contact.id, None) self.status = SaleStatus() self.status.active = True self.status.use_sales = True self.status.use_leads = True self.status.use_opportunities = True self.status.set_default_user() self.status.save() self.assertNotEquals(self.status.id, None) self.currency = Currency(code="GBP", name="Pounds", symbol="L", is_default=True) self.currency.save() self.source = SaleSource() self.source.active = True self.source.save() self.source.set_user(self.user) self.assertNotEquals(self.source.id, None) self.product = Product(name="Test") self.product.product_type = 'service' self.product.active = True self.product.sell_price = 10 self.product.buy_price = 100 self.product.set_default_user() self.product.save() self.assertNotEquals(self.product.id, None) self.subscription = Subscription() self.subscription.client = self.contact self.subscription.set_default_user() self.subscription.save() self.assertNotEquals(self.subscription.id, None) self.lead = Lead() self.lead.contact_method = 'email' self.lead.status = self.status self.lead.contact = self.contact self.lead.set_default_user() self.lead.save() self.assertNotEquals(self.lead.id, None) self.opportunity = Opportunity() self.opportunity.lead = self.lead self.opportunity.contact = self.contact self.opportunity.status = self.status self.opportunity.amount = 100 self.opportunity.amount_currency = self.currency self.opportunity.amount_display = 120 self.opportunity.set_default_user() self.opportunity.save() self.assertNotEquals(self.opportunity.id, None) self.order = SaleOrder(reference="Test") self.order.opportunity = self.opportunity self.order.status = self.status self.order.source = self.source self.order.currency = self.currency self.order.total = 0 self.order.total_display = 0 self.order.set_default_user() self.order.save() self.assertNotEquals(self.order.id, None) self.ordered_product = OrderedProduct() self.ordered_product.product = self.product self.ordered_product.order = self.order self.ordered_product.rate = 0 self.ordered_product.subscription = self.subscription self.ordered_product.set_default_user() self.ordered_product.save() self.assertNotEquals(self.ordered_product.id, None) self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: # Clean up first Object.objects.all().delete() # Create objects try: self.group = Group.objects.get(name="test") except Group.DoesNotExist: Group.objects.all().delete() self.group = Group(name="test") self.group.save() try: self.user = DjangoUser.objects.get(username=self.username) self.user.set_password(self.password) try: self.profile = self.user.get_profile() except Exception: User.objects.all().delete() self.user = DjangoUser(username=self.username, password="") self.user.set_password(self.password) self.user.save() except DjangoUser.DoesNotExist: User.objects.all().delete() self.user = DjangoUser(username=self.username, password="") self.user.set_password(self.password) self.user.save() try: perspective = Perspective.objects.get(name="default") except Perspective.DoesNotExist: Perspective.objects.all().delete() perspective = Perspective(name="default") perspective.set_default_user() perspective.save() ModuleSetting.set("default_perspective", perspective.id) self.type = ItemType(name="test") self.type.set_default_user() self.type.save() self.status = ItemStatus(name="test") self.status.set_default_user() self.status.save() self.field = ItemField(name="test", label="test", field_type="text") self.field.set_default_user() self.field.save() self.item = Item(name="test", item_type=self.type, status=self.status) self.item.set_default_user() self.item.save() self.value = ItemValue(field=self.field, item=self.item) self.value.save() self.servicing = ItemServicing(name="test") self.servicing.set_default_user() self.servicing.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: # Clean up first Object.objects.all().delete() User.objects.all().delete() # Create objects try: self.group = Group.objects.get(name="test") except Group.DoesNotExist: Group.objects.all().delete() self.group = Group(name="test") self.group.save() try: self.user = DjangoUser.objects.get(username=self.username) self.user.set_password(self.password) try: self.profile = self.user.get_profile() except Exception: User.objects.all().delete() self.user = DjangoUser(username=self.username, password="") self.user.set_password(self.password) self.user.save() except DjangoUser.DoesNotExist: User.objects.all().delete() self.user = DjangoUser(username=self.username, password="") self.user.set_password(self.password) self.user.save() try: perspective = Perspective.objects.get(name="default") except Perspective.DoesNotExist: Perspective.objects.all().delete() perspective = Perspective(name="default") perspective.set_user(self.user.get_profile()) perspective.save() ModuleSetting.set("default_perspective", perspective.id) self.contact_type = ContactType(name="test") self.contact_type.set_default_user() self.contact_type.save() self.contact = Contact(name="test", contact_type=self.contact_type) self.contact.set_default_user() self.contact.save() self.status = TicketStatus(name="TestStatus") self.status.set_default_user() self.status.save() self.queue = TicketQueue(name="TestQueue", default_ticket_status=self.status) self.queue.set_default_user() self.queue.save() self.ticket = Ticket(name="TestTicket", status=self.status, queue=self.queue) self.ticket.set_default_user() self.ticket.save() self.agent = ServiceAgent( related_user=self.user.get_profile(), available_from=datetime.time(9), available_to=datetime.time(17) ) self.agent.set_default_user() self.agent.save() self.service = Service(name="test") self.service.set_default_user() self.service.save() self.sla = ServiceLevelAgreement( name="test", service=self.service, client=self.contact, provider=self.contact ) self.sla.set_default_user() self.sla.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: self.group, created = Group.objects.get_or_create(name='test') duser, created = DjangoUser.objects.get_or_create(username=self.username) duser.set_password(self.password) duser.save() self.user, created = User.objects.get_or_create(user=duser) self.user.save() perspective, created = Perspective.objects.get_or_create(name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.contact_type = ContactType() self.contact_type.slug = 'machine' self.contact_type.name = 'machine' self.contact_type.save() self.contact = Contact() self.contact.contact_type = self.contact_type self.contact.set_default_user() self.contact.save() self.assertNotEquals(self.contact.id, None) self.status = SaleStatus() self.status.set_default_user() self.status.save() self.assertNotEquals(self.status.id, None) self.currency = Currency(code="GBP", name="Pounds", symbol="L", is_default=True) self.currency.save() self.source = SaleSource() self.source.set_default_user() self.source.save() self.assertNotEquals(self.source.id, None) self.product = Product(name="Test") self.product.product_type = 'service' self.product.active = True self.product.sell_price = 10 self.product.buy_price = 100 self.product.set_default_user() self.product.save() self.assertNotEquals(self.product.id, None) self.subscription = Subscription() self.subscription.client = self.contact self.subscription.set_default_user() self.subscription.save() self.assertNotEquals(self.subscription.id, None) self.lead = Lead() self.lead.contact_method = 'email' self.lead.status = self.status self.lead.contact = self.contact self.lead.set_default_user() self.lead.save() self.assertNotEquals(self.lead.id, None) self.opportunity = Opportunity() self.opportunity.lead = self.lead self.opportunity.contact = self.contact self.opportunity.status = self.status self.opportunity.amount = 100 self.opportunity.amount_currency = self.currency self.opportunity.amount_display = 120 self.opportunity.set_default_user() self.opportunity.save() self.assertNotEquals(self.opportunity.id, None) self.order = SaleOrder(reference="Test") self.order.opportunity = self.opportunity self.order.status = self.status self.order.source = self.source self.order.currency = self.currency self.order.total = 0 self.order.total_display = 0 self.order.set_default_user() self.order.save() self.assertNotEquals(self.order.id, None) self.ordered_product = OrderedProduct() self.ordered_product.product = self.product self.ordered_product.order = self.order self.ordered_product.rate = 0 self.ordered_product.subscription = self.subscription self.ordered_product.set_default_user() self.ordered_product.save() self.assertNotEquals(self.ordered_product.id, None) self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: # Clean up first Object.objects.all().delete() # Create objects try: self.group = Group.objects.get(name='test') except Group.DoesNotExist: Group.objects.all().delete() self.group = Group(name='test') self.group.save() try: self.user = DjangoUser.objects.get(username=self.username) self.user.set_password(self.password) try: self.profile = self.user.get_profile() except Exception: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() except DjangoUser.DoesNotExist: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() try: perspective = Perspective.objects.get(name='default') except Perspective.DoesNotExist: Perspective.objects.all().delete() perspective = Perspective(name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.type = ItemType(name='test') self.type.set_default_user() self.type.save() self.status = ItemStatus(name='test') self.status.set_default_user() self.status.save() self.field = ItemField(name='test', label='test', field_type='text') self.field.set_default_user() self.field.save() self.item = Item(name='test', item_type=self.type, status=self.status) self.item.set_default_user() self.item.save() self.value = ItemValue(field=self.field, item=self.item) self.value.save() self.servicing = ItemServicing(name='test') self.servicing.set_default_user() self.servicing.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: # Clean up first Object.objects.all().delete() User.objects.all().delete() # Create objects try: self.group = Group.objects.get(name='test') except Group.DoesNotExist: Group.objects.all().delete() self.group = Group(name='test') self.group.save() try: self.user = DjangoUser.objects.get(username=self.username) self.user.set_password(self.password) try: self.profile = self.user.get_profile() except Exception: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() except DjangoUser.DoesNotExist: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() try: perspective = Perspective.objects.get(name='default') except Perspective.DoesNotExist: Perspective.objects.all().delete() perspective = Perspective(name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.contact_type = ContactType(name='test') self.contact_type.set_default_user() self.contact_type.save() self.contact = Contact(name='test', contact_type=self.contact_type) self.contact.set_default_user() self.contact.save() self.category = Category(name='test') self.category.set_default_user() self.category.save() self.equity = Equity(issue_price=10, sell_price=10, issuer=self.contact, owner=self.contact) self.equity.set_default_user() self.equity.save() self.asset = Asset(name='test', owner=self.contact) self.asset.set_default_user() self.asset.save() self.tax = Tax(name='test', rate=10) self.tax.set_default_user() self.tax.save() self.currency = Currency(code="GBP", name="Pounds", symbol="L", is_default=True) self.currency.set_default_user() self.currency.save() self.account = Account(name='test', owner=self.contact, balance_currency=self.currency) self.account.set_default_user() self.account.save() self.liability = Liability(name='test', source=self.contact, target=self.contact, account=self.account, value=10, value_currency=self.currency) self.liability.set_default_user() self.liability.save() self.transaction = Transaction(name='test', account=self.account, source=self.contact, target=self.contact, value=10, value_currency=self.currency) self.transaction.set_default_user() self.transaction.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: # Clean up first Object.objects.all().delete() # Create objects try: self.group = Group.objects.get(name='test') except Group.DoesNotExist: Group.objects.all().delete() self.group = Group(name='test') self.group.save() try: self.user = DjangoUser.objects.get(username=self.username) self.user.set_password(self.password) try: self.profile = self.user.get_profile() except Exception: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() except DjangoUser.DoesNotExist: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() try: perspective = Perspective.objects.get(name='default') except Perspective.DoesNotExist: Perspective.objects.all().delete() perspective = Perspective(name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.contact_type = ContactType(name='test') self.contact_type.set_default_user() self.contact_type.save() self.contact = Contact(name='test', contact_type=self.contact_type) self.contact.set_default_user() self.contact.save() self.user_contact = Contact(name='test', related_user=self.user.get_profile(), contact_type=self.contact_type) self.user_contact.set_user(self.user) self.user_contact.save() self.stream = MessageStream(name='test') self.stream.set_default_user() self.stream.save() self.mlist = MailingList(name='test', from_contact=self.contact) self.mlist.set_default_user() self.mlist.save() self.message = Message(title='test', body='test', author=self.contact, stream=self.stream) self.message.set_default_user() self.message.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: # Clean up first Object.objects.all().delete() User.objects.all().delete() # Create objects try: self.group = Group.objects.get(name='test') except Group.DoesNotExist: Group.objects.all().delete() self.group = Group(name='test') self.group.save() try: self.user = DjangoUser.objects.get(username=self.username) self.user.set_password(self.password) try: self.profile = self.user.get_profile() except Exception: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() except DjangoUser.DoesNotExist: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() try: perspective = Perspective.objects.get(name='default') except Perspective.DoesNotExist: Perspective.objects.all().delete() perspective = Perspective(name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.contact_type = ContactType(name='test') self.contact_type.set_default_user() self.contact_type.save() self.contact = Contact(name='test', contact_type=self.contact_type) self.contact.set_default_user() self.contact.save() self.project = Project(name='test', manager=self.contact, client=self.contact) self.project.set_default_user() self.project.save() self.status = TaskStatus(name='test') self.status.set_default_user() self.status.save() self.milestone = Milestone(name='test', project=self.project, status=self.status) self.milestone.set_default_user() self.milestone.save() self.task = Task(name='test', project=self.project, status=self.status, priority=3) self.task.set_default_user() self.task.save() self.time_slot = TaskTimeSlot(task=self.task, details='test', time_from=datetime.now(), user=self.user.get_profile()) self.time_slot.set_default_user() self.time_slot.save() self.parent = Project(name='test') self.parent.set_default_user() self.parent.save() self.parent_task = Task(name='test', project=self.project, status=self.status, priority=3) self.parent_task.set_default_user() self.parent_task.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: # Clean up first Object.objects.all().delete() User.objects.all().delete() # Create objects try: self.group = Group.objects.get(name='test') except Group.DoesNotExist: Group.objects.all().delete() self.group = Group(name='test') self.group.save() try: self.user = DjangoUser.objects.get(username=self.username) self.user.set_password(self.password) try: self.profile = self.user.get_profile() except Exception: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() except DjangoUser.DoesNotExist: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() try: perspective = Perspective.objects.get(name='default') except Perspective.DoesNotExist: Perspective.objects.all().delete() perspective = Perspective(name='default') perspective.set_user(self.user.get_profile()) perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.contact_type = ContactType(name='test') self.contact_type.set_default_user() self.contact_type.save() self.contact = Contact(name='test', contact_type=self.contact_type) self.contact.set_default_user() self.contact.save() self.status = TicketStatus(name='TestStatus') self.status.set_default_user() self.status.save() self.queue = TicketQueue(name='TestQueue', default_ticket_status=self.status) self.queue.set_default_user() self.queue.save() self.ticket = Ticket(name='TestTicket', status=self.status, queue=self.queue) self.ticket.set_default_user() self.ticket.save() self.agent = ServiceAgent(related_user=self.user.get_profile(), available_from=datetime.time(9), available_to=datetime.time(17)) self.agent.set_default_user() self.agent.save() self.service = Service(name='test') self.service.set_default_user() self.service.save() self.sla = ServiceLevelAgreement(name='test', service=self.service, client=self.contact, provider=self.contact) self.sla.set_default_user() self.sla.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: self.group, created = Group.objects.get_or_create(name='test') duser, created = DjangoUser.objects.get_or_create( username=self.username) duser.set_password(self.password) duser.save() self.user, created = User.objects.get_or_create(user=duser) self.user.save() perspective, created = Perspective.objects.get_or_create( name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.contact_type = ContactType() self.contact_type.slug = 'machine' self.contact_type.name = 'machine' self.contact_type.save() self.contact = Contact() self.contact.contact_type = self.contact_type self.contact.set_default_user() self.contact.save() self.assertNotEquals(self.contact.id, None) self.status = SaleStatus() self.status.set_default_user() self.status.save() self.assertNotEquals(self.status.id, None) self.currency = Currency(code="GBP", name="Pounds", symbol="L", is_default=True) self.currency.save() self.source = SaleSource() self.source.set_default_user() self.source.save() self.assertNotEquals(self.source.id, None) self.product = Product(name="Test") self.product.product_type = 'service' self.product.active = True self.product.sell_price = 10 self.product.buy_price = 100 self.product.set_default_user() self.product.save() self.assertNotEquals(self.product.id, None) self.subscription = Subscription() self.subscription.client = self.contact self.subscription.set_default_user() self.subscription.save() self.assertNotEquals(self.subscription.id, None) self.lead = Lead() self.lead.contact_method = 'email' self.lead.status = self.status self.lead.contact = self.contact self.lead.set_default_user() self.lead.save() self.assertNotEquals(self.lead.id, None) self.opportunity = Opportunity() self.opportunity.lead = self.lead self.opportunity.contact = self.contact self.opportunity.status = self.status self.opportunity.amount = 100 self.opportunity.amount_currency = self.currency self.opportunity.amount_display = 120 self.opportunity.set_default_user() self.opportunity.save() self.assertNotEquals(self.opportunity.id, None) self.order = SaleOrder(reference="Test") self.order.opportunity = self.opportunity self.order.status = self.status self.order.source = self.source self.order.currency = self.currency self.order.total = 0 self.order.total_display = 0 self.order.set_default_user() self.order.save() self.assertNotEquals(self.order.id, None) self.ordered_product = OrderedProduct() self.ordered_product.product = self.product self.ordered_product.order = self.order self.ordered_product.rate = 0 self.ordered_product.subscription = self.subscription self.ordered_product.set_default_user() self.ordered_product.save() self.assertNotEquals(self.ordered_product.id, None) self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: # Clean up first Object.objects.all().delete() User.objects.all().delete() # Create objects try: self.group = Group.objects.get(name='test') except Group.DoesNotExist: Group.objects.all().delete() self.group = Group(name='test') self.group.save() try: self.user = DjangoUser.objects.get(username=self.username) self.user.set_password(self.password) try: self.profile = self.user.get_profile() except Exception: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() except DjangoUser.DoesNotExist: User.objects.all().delete() self.user = DjangoUser(username=self.username, password='') self.user.set_password(self.password) self.user.save() try: perspective = Perspective.objects.get(name='default') except Perspective.DoesNotExist: Perspective.objects.all().delete() perspective = Perspective(name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.contact_type = ContactType(name='test') self.contact_type.set_default_user() self.contact_type.save() self.contact = Contact(name='test', contact_type=self.contact_type) self.contact.set_default_user() self.contact.save() self.category = Category(name='test') self.category.set_default_user() self.category.save() self.equity = Equity( issue_price=10, sell_price=10, issuer=self.contact, owner=self.contact) self.equity.set_default_user() self.equity.save() self.asset = Asset(name='test', owner=self.contact) self.asset.set_default_user() self.asset.save() self.tax = Tax(name='test', rate=10) self.tax.set_default_user() self.tax.save() self.currency = Currency(code="GBP", name="Pounds", symbol="L", is_default=True) self.currency.set_default_user() self.currency.save() self.account = Account( name='test', owner=self.contact, balance_currency=self.currency) self.account.set_default_user() self.account.save() self.liability = Liability(name='test', source=self.contact, target=self.contact, account=self.account, value=10, value_currency=self.currency) self.liability.set_default_user() self.liability.save() self.transaction = Transaction(name='test', account=self.account, source=self.contact, target=self.contact, value=10, value_currency=self.currency) self.transaction.set_default_user() self.transaction.save() self.client = Client() self.prepared = True
def setUp(self): "Initial Setup" if not self.prepared: # Clean up first Object.objects.all().delete() User.objects.all().delete() # Create objects self.group, created = Group.objects.get_or_create(name='test') duser, created = DjangoUser.objects.get_or_create( username=self.username) duser.set_password(self.password) duser.save() self.user, created = User.objects.get_or_create(user=duser) self.user.save() perspective, created = Perspective.objects.get_or_create( name='default') perspective.set_default_user() perspective.save() ModuleSetting.set('default_perspective', perspective.id) self.contact_type = ContactType(name='test') self.contact_type.set_default_user() self.contact_type.save() self.contact = Contact(name='test', contact_type=self.contact_type) self.contact.set_default_user() self.contact.save() self.project = Project(name='test', manager=self.contact, client=self.contact) self.project.set_default_user() self.project.save() self.status = TaskStatus(name='test') self.status.set_default_user() self.status.save() self.milestone = Milestone(name='test', project=self.project, status=self.status) self.milestone.set_default_user() self.milestone.save() self.task = Task(name='test', project=self.project, status=self.status, priority=3) self.task.set_default_user() self.task.save() self.time_slot = TaskTimeSlot(task=self.task, details='test', time_from=datetime.now(), user=self.user) self.time_slot.set_default_user() self.time_slot.save() self.parent = Project(name='test') self.parent.set_default_user() self.parent.save() self.parent_task = Task(name='test', project=self.project, status=self.status, priority=3) self.parent_task.set_default_user() self.parent_task.save() self.client = Client() self.prepared = True