def handle(self, *args, **options):
     vat_settings = VatSettings()
     vat_settings.save()
     Notify.objects.create_notify('*****@*****.**')
     stock = ProductType.objects.create_product_type('stock', 'Stock')
     stationery = ProductCategory.objects.create_product_category(
         'stationery', 'Stationery', stock)
     pencil = Product.objects.create_product('pencil', 'Pencil', '',
                                             Decimal('1.32'), stationery)
     contact_1 = Contact.objects.create_contact(user=get_user_web())
     SalesLedger.objects.create_sales_ledger(contact_1, pencil, 2)
     SalesLedger.objects.create_sales_ledger(contact_1, pencil, 1)
     contact_2 = Contact.objects.create_contact(user=get_user_staff())
     SalesLedger.objects.create_sales_ledger(contact_2, pencil, 6)
     payment_plan = PaymentPlan.objects.create_payment_plan(
         'default',
         'KB Payment Plan',
         Decimal('50'),
         2,
         1,
     )
     ObjectPaymentPlan.objects.create_object_payment_plan(
         contact_1,
         payment_plan,
         Decimal('1000'),
     )
     ObjectPaymentPlan.objects.create_object_payment_plan(
         contact_2,
         payment_plan,
         Decimal('400'),
     )
     # checkout settings
     checkout_settings = CheckoutSettings(default_payment_plan=payment_plan)
     checkout_settings.save()
     print("Created 'checkout' demo data...")
Ejemplo n.º 2
0
def test_contact_detail(perm_check):
    UserContactFactory(user=get_user_web())
    user_contact = UserContactFactory()
    InvoiceContactFactory(contact=user_contact.contact)
    UserContactFactory(contact=user_contact.contact)
    url = reverse('contact.detail', args=[user_contact.contact.pk])
    perm_check.staff(url)
Ejemplo n.º 3
0
 def test_can_edit_not(self):
     """
     A story can only be edited by the person who created it (or a member
     of staff).  The craft fair story was created by an anonymous user.
     """
     story = get_story_craft_fair()
     self.assertFalse(story.user_can_edit(get_user_web()))
Ejemplo n.º 4
0
 def test_can_edit(self):
     """
     A story can be edited by the person who created it (or a member of
     staff).
     """
     story = get_story_market_fire()
     self.assertTrue(story.user_can_edit(get_user_web()))
Ejemplo n.º 5
0
 def setUp(self):
     VatSettingsFactory()
     Notify.objects.create_notify('*****@*****.**')
     default_scenario_login()
     init_app_pay()
     self.web = get_user_web()
     self.assertTrue(self.client.login(
         username=self.web.username,
         password=TEST_PASSWORD,
     ))
     # create a payment
     stock = ProductType.objects.create_product_type('stock', 'Stock')
     stationery = ProductCategory.objects.create_product_category(
         'stationery', 'Stationery', stock
     )
     pencil = Product.objects.create_product(
         'pencil', 'Pencil', '', Decimal('1.32'), stationery
     )
     sales_ledger = SalesLedgerFactory(
         product=pencil,
         quantity=Decimal('2'),
     )
     self.payment = sales_ledger.create_payment()
     self.payment.save()
     self.payment.url = reverse('pay.list')
     self.payment.url_failure = reverse('pay.list')
     self.payment.save()
 def test_contact_detail(self):
     web = get_user_web()
     UserContactFactory(user=web)
     user_contact = UserContactFactory()
     url = reverse(
         'contact.detail',
         kwargs={'slug': user_contact.contact.user.username}
     )
     self.assert_staff_only(url)
Ejemplo n.º 7
0
 def test_update_user_password(self):
     user = get_user_web()
     url = reverse(
         'update_user_password',
         kwargs=dict(pk=user.pk),
     )
     response = self.client.post(
         url,
         dict(
             new_password1='123',
             new_password2='123',
         )
     )
     self.assertEqual(response.status_code, 302)
Ejemplo n.º 8
0
 def test_update_user_name(self):
     user = get_user_web()
     url = reverse(
         'update_user_name',
         kwargs=dict(pk=user.pk),
     )
     self.assertEqual('web', user.username)
     self.client.post(
         url,
         dict(
             username='******',
         )
     )
     user = User.objects.get(username='******')
     self.assertEqual('webber', user.username)
Ejemplo n.º 9
0
 def handle(self, *args, **options):
     vat_settings = VatSettings()
     vat_settings.save()
     Notify.objects.create_notify('*****@*****.**')
     stock = ProductType.objects.create_product_type('stock', 'Stock')
     stationery = ProductCategory.objects.create_product_category(
         'stationery', 'Stationery', stock
     )
     pencil = Product.objects.create_product(
         'pencil', 'Pencil', '', Decimal('1.32'), stationery
     )
     contact_1 = Contact.objects.create_contact(user=get_user_web())
     SalesLedger.objects.create_sales_ledger(
         contact_1, pencil, 2
     )
     SalesLedger.objects.create_sales_ledger(
         contact_1, pencil, 1
     )
     contact_2 = Contact.objects.create_contact(user=get_user_staff())
     SalesLedger.objects.create_sales_ledger(
         contact_2, pencil, 6
     )
     payment_plan = PaymentPlan.objects.create_payment_plan(
         'default',
         'KB Payment Plan',
         Decimal('50'),
         2,
         1,
     )
     ObjectPaymentPlan.objects.create_object_payment_plan(
         contact_1,
         payment_plan,
         Decimal('1000'),
     )
     ObjectPaymentPlan.objects.create_object_payment_plan(
         contact_2,
         payment_plan,
         Decimal('400'),
     )
     # checkout settings
     checkout_settings = CheckoutSettings(default_payment_plan=payment_plan)
     checkout_settings.save()
     print("Created 'checkout' demo data...")
Ejemplo n.º 10
0
def default_scenario_story():
    create_default_moderate_state()
    make_area('Hatherleigh')
    make_area('Exbourne')
    make_story(
        user=get_user_staff(),
        area=get_area_hatherleigh(),
        title='MGs descend on Hatherleigh',
        description=(
            "The Taw and Torridge MG owners club came to Hatherleigh, on "
            "Tuesday, to join the crowds at Hatherleigh Market. They came "
            "to visit Martin at the Hatherleigh Fish Bar. Martin the owner "
            "of the bar also has two MGs."
        )
    )
    make_story(
        user=get_user_web(),
        area=get_area_hatherleigh(),
        title='Market Offices burnt down',
        description=(
            "The market offices burnt down last night. I am sure theories "
            "will abound around the town, but we will have to wait until the "
            "Police have done their bit, before we will know. The offices "
            "and files held within seam to have been totalled destroyed. "
            "Tomorrow's Market should go ahead although the auction will "
            "NOT take place, but the stallholders hopefully will be selling "
            "their wares"
        )
    )
    make_story(
        name='Pat',
        email='*****@*****.**',
        area=get_area_exbourne(),
        title='Craft Fair',
        description=(
            "Over 200 entries were exhibited at the Hatherleigh Craft Show, "
            "at its launch in Hatherleigh Community Centre on Sunday 4th "
            "August. Judges had the difficult task of awarding rosettes for "
            "1st, 2nd & 3rd places in each of the 24 classes, ranging from "
            "knitting to metal work."
        )
    )
 def setUp(self):
     VatSettingsFactory()
     Notify.objects.create_notify('*****@*****.**')
     default_scenario_login()
     #init_app_pay()
     self.web = get_user_web()
     self.assertTrue(
         self.client.login(
             username=self.web.username,
             password=TEST_PASSWORD,
         ))
     # create a payment
     stock = ProductType.objects.create_product_type('stock', 'Stock')
     stationery = ProductCategory.objects.create_product_category(
         'stationery', 'Stationery', stock)
     pencil = Product.objects.create_product('pencil', 'Pencil', '',
                                             Decimal('1.32'), stationery)
     self.sales_ledger = SalesLedgerFactory(
         product=pencil,
         quantity=Decimal('2'),
     )
Ejemplo n.º 12
0
def default_scenario_story():
    create_default_moderate_state()
    make_area('Hatherleigh')
    make_area('Exbourne')
    make_story(
        user=get_user_staff(),
        area=get_area_hatherleigh(),
        title='MGs descend on Hatherleigh',
        description=(
            "The Taw and Torridge MG owners club came to Hatherleigh, on "
            "Tuesday, to join the crowds at Hatherleigh Market. They came "
            "to visit Martin at the Hatherleigh Fish Bar. Martin the owner "
            "of the bar also has two MGs."))
    make_story(
        user=get_user_web(),
        area=get_area_hatherleigh(),
        title='Market Offices burnt down',
        description=(
            "The market offices burnt down last night. I am sure theories "
            "will abound around the town, but we will have to wait until the "
            "Police have done their bit, before we will know. The offices "
            "and files held within seam to have been totalled destroyed. "
            "Tomorrow's Market should go ahead although the auction will "
            "NOT take place, but the stallholders hopefully will be selling "
            "their wares"))
    make_story(
        name='Pat',
        email='*****@*****.**',
        area=get_area_exbourne(),
        title='Craft Fair',
        description=(
            "Over 200 entries were exhibited at the Hatherleigh Craft Show, "
            "at its launch in Hatherleigh Community Centre on Sunday 4th "
            "August. Judges had the difficult task of awarding rosettes for "
            "1st, 2nd & 3rd places in each of the 24 classes, ranging from "
            "knitting to metal work."))
def test_contact_detail(perm_check):
    UserContactFactory(user=get_user_web())
    contact = ContactFactory()
    crm_contact = CrmContactFactory(contact=contact)
    url = reverse('contact.detail', args=[contact.pk])
    perm_check.staff(url)
Ejemplo n.º 14
0
 def login_web(self):
     return self._login_user(get_user_web())
Ejemplo n.º 15
0
 def test_create_trust_html_editor(self):
     web = get_user_web()
     self.client.login(username=web.username, password=web.username)
     response = self.client.get(reverse('pump.story.create.trust'))
     self.assertIn('CKEDITOR', str(response.content))
Ejemplo n.º 16
0
def default_scenario_pump():
    default_page_section()
    default_block_state()
    default_site()
    # story
    make_story(
        make_story_block(get_home_body()),
        get_site_hatherleigh(),
        order=1,
        story_date=datetime.today(),
        user=get_user_staff(),
        title='MGs descend on Hatherleigh',
        description=(
            "The Taw and Torridge MG owners club came to Hatherleigh, on "
            "Tuesday, to join the crowds at Hatherleigh Market. They came "
            "to visit Martin at the Hatherleigh Fish Bar. Martin the owner "
            "of the bar also has two MGs."
        )
    )
    make_story(
        make_story_block(get_home_body()),
        get_site_hatherleigh(),
        order=2,
        story_date=datetime.today(),
        user=get_user_web(),
        title='Market Offices burnt down',
        description=(
            "The market offices burnt down last night. I am sure theories "
            "will abound around the town, but we will have to wait until the "
            "Police have done their bit, before we will know. The offices "
            "and files held within seam to have been totalled destroyed. "
            "Tomorrow's Market should go ahead although the auction will "
            "NOT take place, but the stallholders hopefully will be selling "
            "their wares"
        )
    )
    make_story(
        make_story_block(get_home_body()),
        get_site_hatherleigh(),
        order=3,
        story_date=datetime.today(),
        name='Pat',
        email='*****@*****.**',
        title='Craft Fair',
        description=(
            "Over 200 entries were exhibited at the Hatherleigh Craft Show, "
            "at its launch in Hatherleigh Community Centre on Sunday 4th "
            "August. Judges had the difficult task of awarding rosettes for "
            "1st, 2nd & 3rd places in each of the 24 classes, ranging from "
            "knitting to metal work."
        )
    )
    story_block = make_story_block(get_home_body())
    story_date = datetime.now() + relativedelta(months=-1, day=7)
    make_story(
        story_block,
        get_site_hatherleigh(),
        order=4,
        story_date=story_date,
        name='Pat',
        email='*****@*****.**',
        title='The Market Planning has been Approved',
        description=(
            "I had an eye opening experience, last week, that left me "
            "ashamed of our democracy. The paid planners of the council, "
            "recommended that the outline planning application for "
            "Hatherleigh Market be approved as presented by the paid "
            "consultants."
        )
    )
    story_block.publish(get_user_staff())
    story_block = make_story_block(get_home_body())
    story_date = datetime.now() + relativedelta(months=2, day=7)
    make_story(
        story_block,
        get_site_exbourne_and_jacobstowe(),
        order=5,
        story_date=story_date,
        user=get_user_web(),
        title='Wind Turbines',
        description=(
            "The turbine will be 50 meters high and will affect the view "
            "from Exbourne and Jacobstowe"
        )
    )
    story_block.publish(get_user_staff())
    # event
    event_date = date.today() + relativedelta(days=8)
    make_event(
        make_event_block(get_home_body()),
        get_site_exbourne_and_jacobstowe(),
        order=1,
        user=get_user_web(),
        title='Free Microchipping for Dogs',
        event_date=event_date,
        event_time=time(19, 30),
        description=(
            "Free Microchipping The law is changing! As from the 6th April "
            "2016 you must have your dog microchipped - please visit us at "
            "At The Burrow Cafe, Exbourne on Friday 7th February, between "
            "10am - 12noon, from the Dogs Trust & West Devon Borough Council "
            "Customer Service Advisor to help with all your council and many "
            "public service enquiries Everyone Welcome"
        )
    )
    event_date = date.today() + relativedelta(days=4)
    make_event(
        make_event_block(get_home_body()),
        get_site_hatherleigh(),
        order=2,
        name='Pat',
        email='*****@*****.**',
        title='History Society',
        event_date=event_date,
        event_time=time(19, 30),
        description=(
            "On Monday February 10th at 7:30pm in Old Schools Dr. Janet Few "
            "will be giving an illustrated talk entitled ‘Farm, Fish, Faith "
            "and Family’. As usual all are welcome (non-members £2) The "
            "History Society is currently investigating Hatherleigh’s "
            "prehistoric history and is keen to hear of any finds relating "
            "to this period in particular worked flints such as the one "
            "recently found by a pupil at the School."
        )
    )
    event_date = date.today()
    make_event(
        make_event_block(get_home_body()),
        get_site_hatherleigh(),
        order=3,
        name='Pat',
        email='*****@*****.**',
        title='Temp Title Today',
        event_date=event_date,
        event_time=time(19, 30),
        description=(
            "Temp Description for Today"
        )
    )
    event_date = date.today() + relativedelta(days=-5)
    make_event(
        make_event_block(get_home_body()),
        get_site_hatherleigh(),
        order=4,
        name='Pat',
        email='*****@*****.**',
        title='Temp Title',
        event_date=event_date,
        event_time=time(19, 30),
        description=(
            "Temp Description"
        )
    )
    event_date = date.today() + relativedelta(days=10)
    make_event(
        make_event_block(get_home_body()),
        get_site_hatherleigh(),
        order=5,
        user=get_user_web(),
        title='Gardening Trip',
        event_date=event_date,
        event_time=time(15, 00),
        description=(
            "We are off to Cornwall to visit two very different gardens in "
            "and near Truro: Bosvigo House and Ladock House."
        )
    )
Ejemplo n.º 17
0
 def _login_web(self):
     web = get_user_web()
     self.client.login(
         username=web.username, password=web.username
     )
     return web
Ejemplo n.º 18
0
def test_contact_detail(perm_check):
    UserContactFactory(user=get_user_web())
    user_contact = UserContactFactory()
    url = reverse("contact.detail", args=[user_contact.contact.pk])
    perm_check.staff(url)
Ejemplo n.º 19
0
 def login_web(self):
     return self._login_user(get_user_web())
Ejemplo n.º 20
0
 def test_update_user_password(self):
     url = reverse(
         'update_user_password',
         kwargs=dict(pk=get_user_web().pk),
     )
     self.assert_staff_only(url)