def test_remove_dashboard_permission(self): user = UserFactory(is_staff=False) permission = PermissionFactory(codename='dashboard_access', content_type=ContentType.objects.get( app_label='partner', model='partner')) user.user_permissions.add(permission) partner = PartnerFactory() partner.users.add(user) view = views.PartnerUserUnlinkView() view.unlink_user(user, partner) self.assertEqual(partner.users.count(), 0) self.assertTrue(Permission.objects.filter(pk=permission.pk).exists())
def setUp(self): """ Creates two orders. order_in has self.user in it's partner users list. """ super().setUp() self.address = ShippingAddressFactory() self.basket_in = create_basket() self.basket_out = create_basket() # replace partner with one that has the user in it's users list self.partner_in = PartnerFactory(users=[self.user]) stockrecord = self.basket_in.lines.all()[0].stockrecord stockrecord.partner = self.partner_in stockrecord.save() self.order_in = create_order(basket=self.basket_in, shipping_address=self.address) self.order_out = create_order(basket=self.basket_out, shipping_address=self.address)
def setUp(self): super(TestAStaffUser, self).setUp() self.partner = PartnerFactory()
def setUp(self): super().setUp() self.partner = PartnerFactory()