def setUp(self): self.user = User.objects.create_superuser('mindkeepr', '*****@*****.**', 'admin') self.dumb_user = User.objects.create_user('benoit', '*****@*****.**') self.buy_allowed_user = User.objects.create_user( 'zigzag', '*****@*****.**') self.buy_allowed_user.user_permissions.add( Permission.objects.get(codename='add_buyevent')) self.location = models.Location.objects.create(name="Location 1") self.location2 = models.Location.objects.create(name="Location 2") self.component = models.elements.Component.objects.create( name="Component 1", description="First component !") self.view_event_create = EventsView.as_view({'post': 'create'}) self.view_buyevent_create = BuysView.as_view({'post': 'create'}) self.view_event_list = EventsView.as_view({'get': 'list'}) self.view_event_detail = EventsView.as_view({'get': 'retrieve'})
def setUp(self): self.user = User.objects.create_superuser('mindkeepr', '*****@*****.**', 'admin') self.dumb_user = User.objects.create_user('benoit', '*****@*****.**') self.reserve_allowed_user = User.objects.create_user('zigzag', '*****@*****.**') self.reserve_allowed_user.user_permissions.add(Permission.objects.get(codename='add_useevent')) self.location = models.Location.objects.create(name = "Location 1") self.location2 = models.Location.objects.create(name = "Location 2") self.component = models.elements.Component.objects.create(name = "Component 1",description="First component !") self.project = models.Project.objects.create(name = "Bob and Tesla") self.view_event_create = EventsView.as_view({'post':'create'}) self.view_reserveevent_create = ReservesView.as_view({"post":"create"})
def setUp(self): self.user = User.objects.create_superuser('mindkeepr', '*****@*****.**', 'admin') self.dumb_user = User.objects.create_user('benoit', '*****@*****.**') self.sell_allowed_user = User.objects.create_user('zigzag', '*****@*****.**') self.sell_allowed_user.user_permissions.add(Permission.objects.get(codename='add_sellevent')) self.location = models.Location.objects.create(name = "Location 1") self.location2 = models.Location.objects.create(name = "Location 2") self.component = models.elements.Component.objects.create(name = "Component 1",description="First component !") #stock_repartition = models.StockRepartition.objects.create(quantity=1,status="FREE",location=self.location) #self.component.stock_repartitions.add(stock_repartition) #stock_repartition = models.StockRepartition.objects.create(quantity=5,status="RESERVED",location=self.location) #self.component.stock_repartitions.add(stock_repartition) self.view_event_create = EventsView.as_view({'post':'create'}) self.view_sellevent_create = SellsView.as_view({"post":"create"})
def setUp(self): self.user = User.objects.create_superuser('mindkeepr', '*****@*****.**', 'admin') self.dumb_user = User.objects.create_user('benoit', '*****@*****.**') location = models.Location.objects.create(name="Location 1") location = models.Location.objects.create(name="Location 2") component = models.elements.Component.objects.create( name="Component 1", description="First component !") stock_repartition = models.StockRepartition.objects.create( quantity=1, status="FREE", location=location) component.stock_repartitions.add(stock_repartition) stock_repartition = models.StockRepartition.objects.create( quantity=5, status="RESERVED", location=location) component.stock_repartitions.add(stock_repartition) self.category = models.Category.objects.create(name="Cat") self.view_event_create = EventsView.as_view({'post': 'create'}) self.view_event_list = EventsView.as_view({'get': 'list'}) self.view_component_create = ComponentsView.as_view({'post': 'create'}) self.view_component_list = ComponentsView.as_view({'get': 'list'}) self.view_element_list = ElementsView.as_view({'get': 'list'})